original_string: protected function map_user_data_with_value($mappingidentifier, $value, $header, $map, $key, $courseid, $feedbackgradeid,
              $verbosescales) {
  
          // Fields that the user can be mapped from.
          $userfields = array(
              'userid' => array(
                  'field' => 'id',
                  'label' => 'id',
              ),
              'useridnumber' => array(
                  'field' => 'idnumber',
                  'label' => 'idnumber',
              ),
              'useremail' => array(
                  'field' => 'email',
                  'label' => 'email address',
              ),
              'username' => array(
                  'field' => 'username',
                  'label' => 'username',
              ),
          );
  
          switch ($mappingidentifier) {
              case 'userid':
              case 'useridnumber':
              case 'useremail':
              case 'username':
                  // Skip invalid row with blank user field.
                  if (!empty($value)) {
                      $this->studentid = $this->check_user_exists($value, $userfields[$mappingidentifier]);
                  }
              break;
              case 'new':
                  $this->import_new_grade_item($header, $key, $value);
              break;
              case 'feedback':
                  if ($feedbackgradeid) {
                      $feedback = $this->create_feedback($courseid, $feedbackgradeid, $value);
                      if (isset($feedback)) {
                          $this->newfeedbacks[] = $feedback;
                      }
                  }
              break;
              default:
                  // Existing grade items.
                  if (!empty($map[$key])) {
                      $this->newgrades = $this->update_grade_item($courseid, $map, $key, $verbosescales, $value,
                              $mappingidentifier);
                  }
                  // Otherwise, we ignore this column altogether because user has chosen
                  // to ignore them (e.g. institution, address etc).
              break;
          }
      }
code: protected function map_user_data_with_value($mappingidentifier, $value, $header, $map, $key, $courseid, $feedbackgradeid,
              $verbosescales) {
  
          // Fields that the user can be mapped from.
          $userfields = array(
              'userid' => array(
                  'field' => 'id',
                  'label' => 'id',
              ),
              'useridnumber' => array(
                  'field' => 'idnumber',
                  'label' => 'idnumber',
              ),
              'useremail' => array(
                  'field' => 'email',
                  'label' => 'email address',
              ),
              'username' => array(
                  'field' => 'username',
                  'label' => 'username',
              ),
          );
  
          switch ($mappingidentifier) {
              case 'userid':
              case 'useridnumber':
              case 'useremail':
              case 'username':
                  // Skip invalid row with blank user field.
                  if (!empty($value)) {
                      $this->studentid = $this->check_user_exists($value, $userfields[$mappingidentifier]);
                  }
              break;
              case 'new':
                  $this->import_new_grade_item($header, $key, $value);
              break;
              case 'feedback':
                  if ($feedbackgradeid) {
                      $feedback = $this->create_feedback($courseid, $feedbackgradeid, $value);
                      if (isset($feedback)) {
                          $this->newfeedbacks[] = $feedback;
                      }
                  }
              break;
              default:
                  // Existing grade items.
                  if (!empty($map[$key])) {
                      $this->newgrades = $this->update_grade_item($courseid, $map, $key, $verbosescales, $value,
                              $mappingidentifier);
                  }
                  // Otherwise, we ignore this column altogether because user has chosen
                  // to ignore them (e.g. institution, address etc).
              break;
          }
      }
code_tokens: protected function map_user_data_with_value ( $ mappingidentifier , $ value , $ header , $ map , $ key , $ courseid , $ feedbackgradeid , $ verbosescales ) { // Fields that the user can be mapped from. $ userfields = array ( 'userid' => array ( 'field' => 'id' , 'label' => 'id' , ) , 'useridnumber' => array ( 'field' => 'idnumber' , 'label' => 'idnumber' , ) , 'useremail' => array ( 'field' => 'email' , 'label' => 'email address' , ) , 'username' => array ( 'field' => 'username' , 'label' => 'username' , ) , ) ; switch ( $ mappingidentifier ) { case 'userid' : case 'useridnumber' : case 'useremail' : case 'username' : // Skip invalid row with blank user field. if ( ! empty ( $ value ) ) { $ this -> studentid = $ this -> check_user_exists ( $ value , $ userfields [ $ mappingidentifier ] ) ; } break ; case 'new' : $ this -> import_new_grade_item ( $ header , $ key , $ value ) ; break ; case 'feedback' : if ( $ feedbackgradeid ) { $ feedback = $ this -> create_feedback ( $ courseid , $ feedbackgradeid , $ value ) ; if ( isset ( $ feedback ) ) { $ this -> newfeedbacks [ ] = $ feedback ; } } break ; default : // Existing grade items. if ( ! empty ( $ map [ $ key ] ) ) { $ this -> newgrades = $ this -> update_grade_item ( $ courseid , $ map , $ key , $ verbosescales , $ value , $ mappingidentifier ) ; } // Otherwise, we ignore this column altogether because user has chosen // to ignore them (e.g. institution, address etc). break ; } }
docstring: Check user mapping.
  
  @param string $mappingidentifier The user field that we are matching together.
  @param string $value The value we are checking / importing.
  @param array $header The column headers of the csv file.
  @param array $map Mapping information provided by the user.
  @param int $key Current row identifier.
  @param int $courseid The course ID.
  @param int $feedbackgradeid The ID of the grade item that the feedback relates to.
  @param bool $verbosescales Form setting for grading with scales.
docstring_tokens: Check user mapping .