original_string: public static function delete_data_for_all_users_in_context(\context $context) {
          global $DB;
  
          if ($context->contextlevel == CONTEXT_MODULE) {
              $cm = get_coursemodule_from_id('assign', $context->instanceid);
              if ($cm) {
                  // Get the assignment related to this context.
                  $assign = new \assign($context, null, null);
                  // What to do first... Get sub plugins to delete their stuff.
                  $requestdata = new assign_plugin_request_data($context, $assign);
                  manager::plugintype_class_callback('assignsubmission', self::ASSIGNSUBMISSION_INTERFACE,
                      'delete_submission_for_context', [$requestdata]);
                  $requestdata = new assign_plugin_request_data($context, $assign);
                  manager::plugintype_class_callback('assignfeedback', self::ASSIGNFEEDBACK_INTERFACE,
                      'delete_feedback_for_context', [$requestdata]);
                  $DB->delete_records('assign_grades', ['assignment' => $assign->get_instance()->id]);
  
                  // Delete advanced grading information.
                  $gradingmanager = get_grading_manager($context, 'mod_assign', 'submissions');
                  $controller = $gradingmanager->get_active_controller();
                  if (isset($controller)) {
                      \core_grading\privacy\provider::delete_instance_data($context);
                  }
  
                  // Time to roll my own method for deleting overrides.
                  static::delete_overrides_for_users($assign);
                  $DB->delete_records('assign_submission', ['assignment' => $assign->get_instance()->id]);
                  $DB->delete_records('assign_user_flags', ['assignment' => $assign->get_instance()->id]);
                  $DB->delete_records('assign_user_mapping', ['assignment' => $assign->get_instance()->id]);
              }
          }
      }
code: public static function delete_data_for_all_users_in_context(\context $context) {
          global $DB;
  
          if ($context->contextlevel == CONTEXT_MODULE) {
              $cm = get_coursemodule_from_id('assign', $context->instanceid);
              if ($cm) {
                  // Get the assignment related to this context.
                  $assign = new \assign($context, null, null);
                  // What to do first... Get sub plugins to delete their stuff.
                  $requestdata = new assign_plugin_request_data($context, $assign);
                  manager::plugintype_class_callback('assignsubmission', self::ASSIGNSUBMISSION_INTERFACE,
                      'delete_submission_for_context', [$requestdata]);
                  $requestdata = new assign_plugin_request_data($context, $assign);
                  manager::plugintype_class_callback('assignfeedback', self::ASSIGNFEEDBACK_INTERFACE,
                      'delete_feedback_for_context', [$requestdata]);
                  $DB->delete_records('assign_grades', ['assignment' => $assign->get_instance()->id]);
  
                  // Delete advanced grading information.
                  $gradingmanager = get_grading_manager($context, 'mod_assign', 'submissions');
                  $controller = $gradingmanager->get_active_controller();
                  if (isset($controller)) {
                      \core_grading\privacy\provider::delete_instance_data($context);
                  }
  
                  // Time to roll my own method for deleting overrides.
                  static::delete_overrides_for_users($assign);
                  $DB->delete_records('assign_submission', ['assignment' => $assign->get_instance()->id]);
                  $DB->delete_records('assign_user_flags', ['assignment' => $assign->get_instance()->id]);
                  $DB->delete_records('assign_user_mapping', ['assignment' => $assign->get_instance()->id]);
              }
          }
      }
code_tokens: public static function delete_data_for_all_users_in_context ( \ context $ context ) { global $ DB ; if ( $ context -> contextlevel == CONTEXT_MODULE ) { $ cm = get_coursemodule_from_id ( 'assign' , $ context -> instanceid ) ; if ( $ cm ) { // Get the assignment related to this context. $ assign = new \ assign ( $ context , null , null ) ; // What to do first... Get sub plugins to delete their stuff. $ requestdata = new assign_plugin_request_data ( $ context , $ assign ) ; manager :: plugintype_class_callback ( 'assignsubmission' , self :: ASSIGNSUBMISSION_INTERFACE , 'delete_submission_for_context' , [ $ requestdata ] ) ; $ requestdata = new assign_plugin_request_data ( $ context , $ assign ) ; manager :: plugintype_class_callback ( 'assignfeedback' , self :: ASSIGNFEEDBACK_INTERFACE , 'delete_feedback_for_context' , [ $ requestdata ] ) ; $ DB -> delete_records ( 'assign_grades' , [ 'assignment' => $ assign -> get_instance ( ) -> id ] ) ; // Delete advanced grading information. $ gradingmanager = get_grading_manager ( $ context , 'mod_assign' , 'submissions' ) ; $ controller = $ gradingmanager -> get_active_controller ( ) ; if ( isset ( $ controller ) ) { \ core_grading \ privacy \ provider :: delete_instance_data ( $ context ) ; } // Time to roll my own method for deleting overrides. static :: delete_overrides_for_users ( $ assign ) ; $ DB -> delete_records ( 'assign_submission' , [ 'assignment' => $ assign -> get_instance ( ) -> id ] ) ; $ DB -> delete_records ( 'assign_user_flags' , [ 'assignment' => $ assign -> get_instance ( ) -> id ] ) ; $ DB -> delete_records ( 'assign_user_mapping' , [ 'assignment' => $ assign -> get_instance ( ) -> id ] ) ; } } }
docstring: Delete all use data which matches the specified context.
  
  @param \context $context The module context.
docstring_tokens: Delete all use data which matches the specified context .