original_string: public static function get_submission_assessments($submissionid) {
          global $USER, $DB, $PAGE;
  
          $params = self::validate_parameters(self::get_submission_assessments_parameters(), array('submissionid' => $submissionid));
          $warnings = $assessments = array();
  
          // Get and validate the submission and workshop.
          $submission = $DB->get_record('workshop_submissions', array('id' => $params['submissionid']), '*', MUST_EXIST);
          list($workshop, $course, $cm, $context) = self::validate_workshop($submission->workshopid);
  
          // Check that we can get the assessments and get them.
          self::check_view_submission_assessments($submission, $workshop);
          $assessmentsrecords = $workshop->get_assessments_of_submission($submission->id);
  
          $related = array('context' => $context);
          foreach ($assessmentsrecords as $assessment) {
              $assessment = self::prepare_assessment_for_external($assessment, $workshop);
              if (empty($assessment)) {
                  continue;
              }
              $exporter = new assessment_exporter($assessment, $related);
              $assessments[] = $exporter->export($PAGE->get_renderer('core'));
          }
  
          return array(
              'assessments' => $assessments,
              'warnings' => $warnings
          );
      }
code: public static function get_submission_assessments($submissionid) {
          global $USER, $DB, $PAGE;
  
          $params = self::validate_parameters(self::get_submission_assessments_parameters(), array('submissionid' => $submissionid));
          $warnings = $assessments = array();
  
          // Get and validate the submission and workshop.
          $submission = $DB->get_record('workshop_submissions', array('id' => $params['submissionid']), '*', MUST_EXIST);
          list($workshop, $course, $cm, $context) = self::validate_workshop($submission->workshopid);
  
          // Check that we can get the assessments and get them.
          self::check_view_submission_assessments($submission, $workshop);
          $assessmentsrecords = $workshop->get_assessments_of_submission($submission->id);
  
          $related = array('context' => $context);
          foreach ($assessmentsrecords as $assessment) {
              $assessment = self::prepare_assessment_for_external($assessment, $workshop);
              if (empty($assessment)) {
                  continue;
              }
              $exporter = new assessment_exporter($assessment, $related);
              $assessments[] = $exporter->export($PAGE->get_renderer('core'));
          }
  
          return array(
              'assessments' => $assessments,
              'warnings' => $warnings
          );
      }
code_tokens: public static function get_submission_assessments ( $ submissionid ) { global $ USER , $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: get_submission_assessments_parameters ( ) , array ( 'submissionid' => $ submissionid ) ) ; $ warnings = $ assessments = array ( ) ; // Get and validate the submission and workshop. $ submission = $ DB -> get_record ( 'workshop_submissions' , array ( 'id' => $ params [ 'submissionid' ] ) , '*' , MUST_EXIST ) ; list ( $ workshop , $ course , $ cm , $ context ) = self :: validate_workshop ( $ submission -> workshopid ) ; // Check that we can get the assessments and get them. self :: check_view_submission_assessments ( $ submission , $ workshop ) ; $ assessmentsrecords = $ workshop -> get_assessments_of_submission ( $ submission -> id ) ; $ related = array ( 'context' => $ context ) ; foreach ( $ assessmentsrecords as $ assessment ) { $ assessment = self :: prepare_assessment_for_external ( $ assessment , $ workshop ) ; if ( empty ( $ assessment ) ) { continue ; } $ exporter = new assessment_exporter ( $ assessment , $ related ) ; $ assessments [ ] = $ exporter -> export ( $ PAGE -> get_renderer ( 'core' ) ) ; } return array ( 'assessments' => $ assessments , 'warnings' => $ warnings ) ; }
docstring: Retrieves the given submission assessments.
  
  @param int $submissionid the submission id
  @return array containing the assessments and warnings.
  @since Moodle 3.4
  @throws moodle_exception
docstring_tokens: Retrieves the given submission assessments .