original_string: public function lock_submission($userid) {
          global $USER, $DB;
          // Need grade permission.
          require_capability('mod/assign:grade', $this->context);
  
          // Give each submission plugin a chance to process the locking.
          $plugins = $this->get_submission_plugins();
          $submission = $this->get_user_submission($userid, false);
  
          $flags = $this->get_user_flags($userid, true);
          $flags->locked = 1;
          $this->update_user_flags($flags);
  
          foreach ($plugins as $plugin) {
              if ($plugin->is_enabled() && $plugin->is_visible()) {
                  $plugin->lock($submission, $flags);
              }
          }
  
          $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
          \mod_assign\event\submission_locked::create_from_user($this, $user)->trigger();
          return true;
      }
code: public function lock_submission($userid) {
          global $USER, $DB;
          // Need grade permission.
          require_capability('mod/assign:grade', $this->context);
  
          // Give each submission plugin a chance to process the locking.
          $plugins = $this->get_submission_plugins();
          $submission = $this->get_user_submission($userid, false);
  
          $flags = $this->get_user_flags($userid, true);
          $flags->locked = 1;
          $this->update_user_flags($flags);
  
          foreach ($plugins as $plugin) {
              if ($plugin->is_enabled() && $plugin->is_visible()) {
                  $plugin->lock($submission, $flags);
              }
          }
  
          $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
          \mod_assign\event\submission_locked::create_from_user($this, $user)->trigger();
          return true;
      }
code_tokens: public function lock_submission ( $ userid ) { global $ USER , $ DB ; // Need grade permission. require_capability ( 'mod/assign:grade' , $ this -> context ) ; // Give each submission plugin a chance to process the locking. $ plugins = $ this -> get_submission_plugins ( ) ; $ submission = $ this -> get_user_submission ( $ userid , false ) ; $ flags = $ this -> get_user_flags ( $ userid , true ) ; $ flags -> locked = 1 ; $ this -> update_user_flags ( $ flags ) ; foreach ( $ plugins as $ plugin ) { if ( $ plugin -> is_enabled ( ) && $ plugin -> is_visible ( ) ) { $ plugin -> lock ( $ submission , $ flags ) ; } } $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ userid ) , '*' , MUST_EXIST ) ; \ mod_assign \ event \ submission_locked :: create_from_user ( $ this , $ user ) -> trigger ( ) ; return true ; }
docstring: Prevent student updates to this submission
  
  @param int $userid
  @return bool
docstring_tokens: Prevent student updates to this submission