original_string: public function set_overridden($state, $refresh = true) {
          if (empty($this->overridden) and $state) {
              $this->overridden = time();
              $this->update();
              return true;
  
          } else if (!empty($this->overridden) and !$state) {
              $this->overridden = 0;
              $this->update();
  
              if ($refresh) {
                  //refresh when unlocking
                  $this->grade_item->refresh_grades($this->userid);
              }
  
              return true;
          }
          return false;
      }
code: public function set_overridden($state, $refresh = true) {
          if (empty($this->overridden) and $state) {
              $this->overridden = time();
              $this->update();
              return true;
  
          } else if (!empty($this->overridden) and !$state) {
              $this->overridden = 0;
              $this->update();
  
              if ($refresh) {
                  //refresh when unlocking
                  $this->grade_item->refresh_grades($this->userid);
              }
  
              return true;
          }
          return false;
      }
code_tokens: public function set_overridden ( $ state , $ refresh = true ) { if ( empty ( $ this -> overridden ) and $ state ) { $ this -> overridden = time ( ) ; $ this -> update ( ) ; return true ; } else if ( ! empty ( $ this -> overridden ) and ! $ state ) { $ this -> overridden = 0 ; $ this -> update ( ) ; if ( $ refresh ) { //refresh when unlocking $ this -> grade_item -> refresh_grades ( $ this -> userid ) ; } return true ; } return false ; }
docstring: Set the overridden status of grade
  
  @param bool $state requested overridden state
  @param bool $refresh refresh grades from external activities if needed
  @return bool true is db state changed
docstring_tokens: Set the overridden status of grade