original_string: public static function export_user_data(approved_contextlist $contextlist) {
          global $DB;
          // Export rules.
          $context = \context_user::instance($contextlist->get_user()->id);
          $rules = $DB->get_records('tool_monitor_rules', ['userid' => $contextlist->get_user()->id]);
          if ($rules) {
              static::export_monitor_rules($rules, $context);
          }
          // Export subscriptions.
          $subscriptions = subscription_manager::get_user_subscriptions(0, 0, $contextlist->get_user()->id);
          if ($subscriptions) {
              static::export_monitor_subscriptions($subscriptions, $context);
          }
      }
code: public static function export_user_data(approved_contextlist $contextlist) {
          global $DB;
          // Export rules.
          $context = \context_user::instance($contextlist->get_user()->id);
          $rules = $DB->get_records('tool_monitor_rules', ['userid' => $contextlist->get_user()->id]);
          if ($rules) {
              static::export_monitor_rules($rules, $context);
          }
          // Export subscriptions.
          $subscriptions = subscription_manager::get_user_subscriptions(0, 0, $contextlist->get_user()->id);
          if ($subscriptions) {
              static::export_monitor_subscriptions($subscriptions, $context);
          }
      }
code_tokens: public static function export_user_data ( approved_contextlist $ contextlist ) { global $ DB ; // Export rules. $ context = \ context_user :: instance ( $ contextlist -> get_user ( ) -> id ) ; $ rules = $ DB -> get_records ( 'tool_monitor_rules' , [ 'userid' => $ contextlist -> get_user ( ) -> id ] ) ; if ( $ rules ) { static :: export_monitor_rules ( $ rules , $ context ) ; } // Export subscriptions. $ subscriptions = subscription_manager :: get_user_subscriptions ( 0 , 0 , $ contextlist -> get_user ( ) -> id ) ; if ( $ subscriptions ) { static :: export_monitor_subscriptions ( $ subscriptions , $ context ) ; } }
docstring: Export all event monitor information for the list of contexts and this user.
  
  @param  approved_contextlist $contextlist The list of approved contexts for a user.
docstring_tokens: Export all event monitor information for the list of contexts and this user .