original_string: public static function data_for_messagearea_contacts($userid, $limitfrom = 0, $limitnum = 0) {
          global $CFG, $PAGE, $USER;
  
          // Check if messaging is enabled.
          if (empty($CFG->messaging)) {
              throw new moodle_exception('disabled', 'message');
          }
  
          $systemcontext = context_system::instance();
  
          $params = array(
              'userid' => $userid,
              'limitfrom' => $limitfrom,
              'limitnum' => $limitnum
          );
          $params = self::validate_parameters(self::data_for_messagearea_contacts_parameters(), $params);
          self::validate_context($systemcontext);
  
          if (($USER->id != $params['userid']) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
              throw new moodle_exception('You do not have permission to perform this action.');
          }
  
          $contacts = \core_message\api::get_contacts($params['userid'], $params['limitfrom'], $params['limitnum']);
          $contacts = new \core_message\output\messagearea\contacts(null, $contacts);
  
          $renderer = $PAGE->get_renderer('core_message');
          return $contacts->export_for_template($renderer);
      }
code: public static function data_for_messagearea_contacts($userid, $limitfrom = 0, $limitnum = 0) {
          global $CFG, $PAGE, $USER;
  
          // Check if messaging is enabled.
          if (empty($CFG->messaging)) {
              throw new moodle_exception('disabled', 'message');
          }
  
          $systemcontext = context_system::instance();
  
          $params = array(
              'userid' => $userid,
              'limitfrom' => $limitfrom,
              'limitnum' => $limitnum
          );
          $params = self::validate_parameters(self::data_for_messagearea_contacts_parameters(), $params);
          self::validate_context($systemcontext);
  
          if (($USER->id != $params['userid']) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
              throw new moodle_exception('You do not have permission to perform this action.');
          }
  
          $contacts = \core_message\api::get_contacts($params['userid'], $params['limitfrom'], $params['limitnum']);
          $contacts = new \core_message\output\messagearea\contacts(null, $contacts);
  
          $renderer = $PAGE->get_renderer('core_message');
          return $contacts->export_for_template($renderer);
      }
code_tokens: public static function data_for_messagearea_contacts ( $ userid , $ limitfrom = 0 , $ limitnum = 0 ) { global $ CFG , $ PAGE , $ USER ; // Check if messaging is enabled. if ( empty ( $ CFG -> messaging ) ) { throw new moodle_exception ( 'disabled' , 'message' ) ; } $ systemcontext = context_system :: instance ( ) ; $ params = array ( 'userid' => $ userid , 'limitfrom' => $ limitfrom , 'limitnum' => $ limitnum ) ; $ params = self :: validate_parameters ( self :: data_for_messagearea_contacts_parameters ( ) , $ params ) ; self :: validate_context ( $ systemcontext ) ; if ( ( $ USER -> id != $ params [ 'userid' ] ) && ! has_capability ( 'moodle/site:readallmessages' , $ systemcontext ) ) { throw new moodle_exception ( 'You do not have permission to perform this action.' ) ; } $ contacts = \ core_message \ api :: get_contacts ( $ params [ 'userid' ] , $ params [ 'limitfrom' ] , $ params [ 'limitnum' ] ) ; $ contacts = new \ core_message \ output \ messagearea \ contacts ( null , $ contacts ) ; $ renderer = $ PAGE -> get_renderer ( 'core_message' ) ; return $ contacts -> export_for_template ( $ renderer ) ; }
docstring: Get messagearea contacts parameters.
  
  @deprecated since 3.6
  @param int $userid The id of the user who we are viewing conversations for
  @param int $limitfrom
  @param int $limitnum
  @return stdClass
  @throws moodle_exception
  @since 3.2
docstring_tokens: Get messagearea contacts parameters .