original_string: protected function view_plugin_content($pluginsubtype) {
          $o = '';
  
          $submissionid = optional_param('sid', 0, PARAM_INT);
          $gradeid = optional_param('gid', 0, PARAM_INT);
          $plugintype = required_param('plugin', PARAM_PLUGIN);
          $item = null;
          if ($pluginsubtype == 'assignsubmission') {
              $plugin = $this->get_submission_plugin_by_type($plugintype);
              if ($submissionid <= 0) {
                  throw new coding_exception('Submission id should not be 0');
              }
              $item = $this->get_submission($submissionid);
  
              // Check permissions.
              if (empty($item->userid)) {
                  // Group submission.
                  $this->require_view_group_submission($item->groupid);
              } else {
                  $this->require_view_submission($item->userid);
              }
              $o .= $this->get_renderer()->render(new assign_header($this->get_instance(),
                                                                $this->get_context(),
                                                                $this->show_intro(),
                                                                $this->get_course_module()->id,
                                                                $plugin->get_name()));
              $o .= $this->get_renderer()->render(new assign_submission_plugin_submission($plugin,
                                                                $item,
                                                                assign_submission_plugin_submission::FULL,
                                                                $this->get_course_module()->id,
                                                                $this->get_return_action(),
                                                                $this->get_return_params()));
  
              // Trigger event for viewing a submission.
              \mod_assign\event\submission_viewed::create_from_submission($this, $item)->trigger();
  
          } else {
              $plugin = $this->get_feedback_plugin_by_type($plugintype);
              if ($gradeid <= 0) {
                  throw new coding_exception('Grade id should not be 0');
              }
              $item = $this->get_grade($gradeid);
              // Check permissions.
              $this->require_view_submission($item->userid);
              $o .= $this->get_renderer()->render(new assign_header($this->get_instance(),
                                                                $this->get_context(),
                                                                $this->show_intro(),
                                                                $this->get_course_module()->id,
                                                                $plugin->get_name()));
              $o .= $this->get_renderer()->render(new assign_feedback_plugin_feedback($plugin,
                                                                $item,
                                                                assign_feedback_plugin_feedback::FULL,
                                                                $this->get_course_module()->id,
                                                                $this->get_return_action(),
                                                                $this->get_return_params()));
  
              // Trigger event for viewing feedback.
              \mod_assign\event\feedback_viewed::create_from_grade($this, $item)->trigger();
          }
  
          $o .= $this->view_return_links();
  
          $o .= $this->view_footer();
  
          return $o;
      }
code: protected function view_plugin_content($pluginsubtype) {
          $o = '';
  
          $submissionid = optional_param('sid', 0, PARAM_INT);
          $gradeid = optional_param('gid', 0, PARAM_INT);
          $plugintype = required_param('plugin', PARAM_PLUGIN);
          $item = null;
          if ($pluginsubtype == 'assignsubmission') {
              $plugin = $this->get_submission_plugin_by_type($plugintype);
              if ($submissionid <= 0) {
                  throw new coding_exception('Submission id should not be 0');
              }
              $item = $this->get_submission($submissionid);
  
              // Check permissions.
              if (empty($item->userid)) {
                  // Group submission.
                  $this->require_view_group_submission($item->groupid);
              } else {
                  $this->require_view_submission($item->userid);
              }
              $o .= $this->get_renderer()->render(new assign_header($this->get_instance(),
                                                                $this->get_context(),
                                                                $this->show_intro(),
                                                                $this->get_course_module()->id,
                                                                $plugin->get_name()));
              $o .= $this->get_renderer()->render(new assign_submission_plugin_submission($plugin,
                                                                $item,
                                                                assign_submission_plugin_submission::FULL,
                                                                $this->get_course_module()->id,
                                                                $this->get_return_action(),
                                                                $this->get_return_params()));
  
              // Trigger event for viewing a submission.
              \mod_assign\event\submission_viewed::create_from_submission($this, $item)->trigger();
  
          } else {
              $plugin = $this->get_feedback_plugin_by_type($plugintype);
              if ($gradeid <= 0) {
                  throw new coding_exception('Grade id should not be 0');
              }
              $item = $this->get_grade($gradeid);
              // Check permissions.
              $this->require_view_submission($item->userid);
              $o .= $this->get_renderer()->render(new assign_header($this->get_instance(),
                                                                $this->get_context(),
                                                                $this->show_intro(),
                                                                $this->get_course_module()->id,
                                                                $plugin->get_name()));
              $o .= $this->get_renderer()->render(new assign_feedback_plugin_feedback($plugin,
                                                                $item,
                                                                assign_feedback_plugin_feedback::FULL,
                                                                $this->get_course_module()->id,
                                                                $this->get_return_action(),
                                                                $this->get_return_params()));
  
              // Trigger event for viewing feedback.
              \mod_assign\event\feedback_viewed::create_from_grade($this, $item)->trigger();
          }
  
          $o .= $this->view_return_links();
  
          $o .= $this->view_footer();
  
          return $o;
      }
code_tokens: protected function view_plugin_content ( $ pluginsubtype ) { $ o = '' ; $ submissionid = optional_param ( 'sid' , 0 , PARAM_INT ) ; $ gradeid = optional_param ( 'gid' , 0 , PARAM_INT ) ; $ plugintype = required_param ( 'plugin' , PARAM_PLUGIN ) ; $ item = null ; if ( $ pluginsubtype == 'assignsubmission' ) { $ plugin = $ this -> get_submission_plugin_by_type ( $ plugintype ) ; if ( $ submissionid <= 0 ) { throw new coding_exception ( 'Submission id should not be 0' ) ; } $ item = $ this -> get_submission ( $ submissionid ) ; // Check permissions. if ( empty ( $ item -> userid ) ) { // Group submission. $ this -> require_view_group_submission ( $ item -> groupid ) ; } else { $ this -> require_view_submission ( $ item -> userid ) ; } $ o .= $ this -> get_renderer ( ) -> render ( new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , $ this -> show_intro ( ) , $ this -> get_course_module ( ) -> id , $ plugin -> get_name ( ) ) ) ; $ o .= $ this -> get_renderer ( ) -> render ( new assign_submission_plugin_submission ( $ plugin , $ item , assign_submission_plugin_submission :: FULL , $ this -> get_course_module ( ) -> id , $ this -> get_return_action ( ) , $ this -> get_return_params ( ) ) ) ; // Trigger event for viewing a submission. \ mod_assign \ event \ submission_viewed :: create_from_submission ( $ this , $ item ) -> trigger ( ) ; } else { $ plugin = $ this -> get_feedback_plugin_by_type ( $ plugintype ) ; if ( $ gradeid <= 0 ) { throw new coding_exception ( 'Grade id should not be 0' ) ; } $ item = $ this -> get_grade ( $ gradeid ) ; // Check permissions. $ this -> require_view_submission ( $ item -> userid ) ; $ o .= $ this -> get_renderer ( ) -> render ( new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , $ this -> show_intro ( ) , $ this -> get_course_module ( ) -> id , $ plugin -> get_name ( ) ) ) ; $ o .= $ this -> get_renderer ( ) -> render ( new assign_feedback_plugin_feedback ( $ plugin , $ item , assign_feedback_plugin_feedback :: FULL , $ this -> get_course_module ( ) -> id , $ this -> get_return_action ( ) , $ this -> get_return_params ( ) ) ) ; // Trigger event for viewing feedback. \ mod_assign \ event \ feedback_viewed :: create_from_grade ( $ this , $ item ) -> trigger ( ) ; } $ o .= $ this -> view_return_links ( ) ; $ o .= $ this -> view_footer ( ) ; return $ o ; }
docstring: Display the submission that is used by a plugin.
  
  Uses url parameters 'sid', 'gid' and 'plugin'.
  
  @param string $pluginsubtype
  @return string
docstring_tokens: Display the submission that is used by a plugin .