original_string: public static function create($data) {
          global $USER, $DB, $CFG;
          $data->requester = $USER->id;
  
          // Setting the default category if none set.
          if (empty($data->category) || empty($CFG->requestcategoryselection)) {
              $data->category = $CFG->defaultrequestcategory;
          }
  
          // Summary is a required field so copy the text over
          $data->summary       = $data->summary_editor['text'];
          $data->summaryformat = $data->summary_editor['format'];
  
          $data->id = $DB->insert_record('course_request', $data);
  
          // Create a new course_request object and return it
          $request = new course_request($data);
  
          // Notify the admin if required.
          if ($users = get_users_from_config($CFG->courserequestnotify, 'moodle/site:approvecourse')) {
  
              $a = new stdClass;
              $a->link = "$CFG->wwwroot/course/pending.php";
              $a->user = fullname($USER);
              $subject = get_string('courserequest');
              $message = get_string('courserequestnotifyemail', 'admin', $a);
              foreach ($users as $user) {
                  $request->notify($user, $USER, 'courserequested', $subject, $message);
              }
          }
  
          return $request;
      }
code: public static function create($data) {
          global $USER, $DB, $CFG;
          $data->requester = $USER->id;
  
          // Setting the default category if none set.
          if (empty($data->category) || empty($CFG->requestcategoryselection)) {
              $data->category = $CFG->defaultrequestcategory;
          }
  
          // Summary is a required field so copy the text over
          $data->summary       = $data->summary_editor['text'];
          $data->summaryformat = $data->summary_editor['format'];
  
          $data->id = $DB->insert_record('course_request', $data);
  
          // Create a new course_request object and return it
          $request = new course_request($data);
  
          // Notify the admin if required.
          if ($users = get_users_from_config($CFG->courserequestnotify, 'moodle/site:approvecourse')) {
  
              $a = new stdClass;
              $a->link = "$CFG->wwwroot/course/pending.php";
              $a->user = fullname($USER);
              $subject = get_string('courserequest');
              $message = get_string('courserequestnotifyemail', 'admin', $a);
              foreach ($users as $user) {
                  $request->notify($user, $USER, 'courserequested', $subject, $message);
              }
          }
  
          return $request;
      }
code_tokens: public static function create ( $ data ) { global $ USER , $ DB , $ CFG ; $ data -> requester = $ USER -> id ; // Setting the default category if none set. if ( empty ( $ data -> category ) || empty ( $ CFG -> requestcategoryselection ) ) { $ data -> category = $ CFG -> defaultrequestcategory ; } // Summary is a required field so copy the text over $ data -> summary = $ data -> summary_editor [ 'text' ] ; $ data -> summaryformat = $ data -> summary_editor [ 'format' ] ; $ data -> id = $ DB -> insert_record ( 'course_request' , $ data ) ; // Create a new course_request object and return it $ request = new course_request ( $ data ) ; // Notify the admin if required. if ( $ users = get_users_from_config ( $ CFG -> courserequestnotify , 'moodle/site:approvecourse' ) ) { $ a = new stdClass ; $ a -> link = "$CFG->wwwroot/course/pending.php" ; $ a -> user = fullname ( $ USER ) ; $ subject = get_string ( 'courserequest' ) ; $ message = get_string ( 'courserequestnotifyemail' , 'admin' , $ a ) ; foreach ( $ users as $ user ) { $ request -> notify ( $ user , $ USER , 'courserequested' , $ subject , $ message ) ; } } return $ request ; }
docstring: Static function to create a new course request when passed an array of properties
  for it.
  
  This function also handles saving any files that may have been used in the editor
  
  @static
  @param stdClass $data
  @return course_request The newly created course request
docstring_tokens: Static function to create a new course request when passed an array of properties for it .