original_string: protected static function export_user_data_notifications(int $userid) {
          global $DB;
  
          $context = \context_user::instance($userid);
  
          $notificationdata = [];
          $select = "useridfrom = ? OR useridto = ?";
          $notifications = $DB->get_recordset_select('notifications', $select, [$userid, $userid], 'timecreated ASC');
          foreach ($notifications as $notification) {
              $timeread = !is_null($notification->timeread) ? transform::datetime($notification->timeread) : '-';
  
              $data = (object) [
                  'subject' => $notification->subject,
                  'fullmessage' => $notification->fullmessage,
                  'smallmessage' => $notification->smallmessage,
                  'component' => $notification->component,
                  'eventtype' => $notification->eventtype,
                  'contexturl' => $notification->contexturl,
                  'contexturlname' => $notification->contexturlname,
                  'timeread' => $timeread,
                  'timecreated' => transform::datetime($notification->timecreated),
                  'customdata' => $notification->customdata,
              ];
  
              $notificationdata[] = $data;
          }
          $notifications->close();
  
          writer::with_context($context)->export_data([get_string('notifications', 'core_message')], (object) $notificationdata);
      }
code: protected static function export_user_data_notifications(int $userid) {
          global $DB;
  
          $context = \context_user::instance($userid);
  
          $notificationdata = [];
          $select = "useridfrom = ? OR useridto = ?";
          $notifications = $DB->get_recordset_select('notifications', $select, [$userid, $userid], 'timecreated ASC');
          foreach ($notifications as $notification) {
              $timeread = !is_null($notification->timeread) ? transform::datetime($notification->timeread) : '-';
  
              $data = (object) [
                  'subject' => $notification->subject,
                  'fullmessage' => $notification->fullmessage,
                  'smallmessage' => $notification->smallmessage,
                  'component' => $notification->component,
                  'eventtype' => $notification->eventtype,
                  'contexturl' => $notification->contexturl,
                  'contexturlname' => $notification->contexturlname,
                  'timeread' => $timeread,
                  'timecreated' => transform::datetime($notification->timecreated),
                  'customdata' => $notification->customdata,
              ];
  
              $notificationdata[] = $data;
          }
          $notifications->close();
  
          writer::with_context($context)->export_data([get_string('notifications', 'core_message')], (object) $notificationdata);
      }
code_tokens: protected static function export_user_data_notifications ( int $ userid ) { global $ DB ; $ context = \ context_user :: instance ( $ userid ) ; $ notificationdata = [ ] ; $ select = "useridfrom = ? OR useridto = ?" ; $ notifications = $ DB -> get_recordset_select ( 'notifications' , $ select , [ $ userid , $ userid ] , 'timecreated ASC' ) ; foreach ( $ notifications as $ notification ) { $ timeread = ! is_null ( $ notification -> timeread ) ? transform :: datetime ( $ notification -> timeread ) : '-' ; $ data = ( object ) [ 'subject' => $ notification -> subject , 'fullmessage' => $ notification -> fullmessage , 'smallmessage' => $ notification -> smallmessage , 'component' => $ notification -> component , 'eventtype' => $ notification -> eventtype , 'contexturl' => $ notification -> contexturl , 'contexturlname' => $ notification -> contexturlname , 'timeread' => $ timeread , 'timecreated' => transform :: datetime ( $ notification -> timecreated ) , 'customdata' => $ notification -> customdata , ] ; $ notificationdata [ ] = $ data ; } $ notifications -> close ( ) ; writer :: with_context ( $ context ) -> export_data ( [ get_string ( 'notifications' , 'core_message' ) ] , ( object ) $ notificationdata ) ; }
docstring: Export the notification data.
  
  @param int $userid
docstring_tokens: Export the notification data .