original_string: public function add_report_nodes($userid, $nodeinfo) {
          global $USER;
          // Try to find the specific user node.
          $newusernode = $this->navigation->find('user' . $userid, null);
          $reportnode = null;
          $navigationnodeerror =
                  'Could not find the navigation node requested. Please check that the node you are looking for exists.';
          if ($userid != $USER->id) {
              // Check that we have a valid node.
              if (empty($newusernode)) {
                  // Throw an error if we ever reach here.
                  throw new coding_exception($navigationnodeerror);
              }
              // Add 'Reports' to the user node.
              $reportnode = $newusernode->add(get_string('reports'));
          } else {
              // We are looking at our own profile.
              $myprofilenode = $this->settingsnav->find('myprofile', null);
              // Check that we do end up with a valid node.
              if (empty($myprofilenode)) {
                  // Throw an error if we ever reach here.
                  throw new coding_exception($navigationnodeerror);
              }
              // Add 'Reports' to our node.
              $reportnode = $myprofilenode->add(get_string('reports'));
          }
          // Finally add the report to the navigation tree.
          $reportnode->add($nodeinfo['name'], $nodeinfo['url'], navigation_node::TYPE_COURSE);
      }
code: public function add_report_nodes($userid, $nodeinfo) {
          global $USER;
          // Try to find the specific user node.
          $newusernode = $this->navigation->find('user' . $userid, null);
          $reportnode = null;
          $navigationnodeerror =
                  'Could not find the navigation node requested. Please check that the node you are looking for exists.';
          if ($userid != $USER->id) {
              // Check that we have a valid node.
              if (empty($newusernode)) {
                  // Throw an error if we ever reach here.
                  throw new coding_exception($navigationnodeerror);
              }
              // Add 'Reports' to the user node.
              $reportnode = $newusernode->add(get_string('reports'));
          } else {
              // We are looking at our own profile.
              $myprofilenode = $this->settingsnav->find('myprofile', null);
              // Check that we do end up with a valid node.
              if (empty($myprofilenode)) {
                  // Throw an error if we ever reach here.
                  throw new coding_exception($navigationnodeerror);
              }
              // Add 'Reports' to our node.
              $reportnode = $myprofilenode->add(get_string('reports'));
          }
          // Finally add the report to the navigation tree.
          $reportnode->add($nodeinfo['name'], $nodeinfo['url'], navigation_node::TYPE_COURSE);
      }
code_tokens: public function add_report_nodes ( $ userid , $ nodeinfo ) { global $ USER ; // Try to find the specific user node. $ newusernode = $ this -> navigation -> find ( 'user' . $ userid , null ) ; $ reportnode = null ; $ navigationnodeerror = 'Could not find the navigation node requested. Please check that the node you are looking for exists.' ; if ( $ userid != $ USER -> id ) { // Check that we have a valid node. if ( empty ( $ newusernode ) ) { // Throw an error if we ever reach here. throw new coding_exception ( $ navigationnodeerror ) ; } // Add 'Reports' to the user node. $ reportnode = $ newusernode -> add ( get_string ( 'reports' ) ) ; } else { // We are looking at our own profile. $ myprofilenode = $ this -> settingsnav -> find ( 'myprofile' , null ) ; // Check that we do end up with a valid node. if ( empty ( $ myprofilenode ) ) { // Throw an error if we ever reach here. throw new coding_exception ( $ navigationnodeerror ) ; } // Add 'Reports' to our node. $ reportnode = $ myprofilenode -> add ( get_string ( 'reports' ) ) ; } // Finally add the report to the navigation tree. $ reportnode -> add ( $ nodeinfo [ 'name' ] , $ nodeinfo [ 'url' ] , navigation_node :: TYPE_COURSE ) ; }
docstring: Add a report node and a specific report to the navigation.
  
  @param int $userid The user ID that we are looking to add this report node to.
  @param array $nodeinfo Name and url of the final node that we are creating.
docstring_tokens: Add a report node and a specific report to the navigation .