function write_setting($data) {
        global $CFG;

        $previous = $this->get_setting();
        $result = parent::write_setting($data);

        // If saved and the value has changed.
        if (empty($result) && $previous != $data) {
            require_once($CFG->libdir . '/gradelib.php');
            grade_force_site_regrading();
        }

        return $result;
    }
function write_setting($data) {
        global $CFG;

        $previous = $this->get_setting();
        $result = parent::write_setting($data);

        // If saved and the value has changed.
        if (empty($result) && $previous != $data) {
            require_once($CFG->libdir . '/gradelib.php');
            grade_force_site_regrading();
        }

        return $result;
    }
function write_setting ( $ data ) { global $ CFG ; $ previous = $ this -> get_setting ( ) ; $ result = parent :: write_setting ( $ data ) ; // If saved and the value has changed. if ( empty ( $ result ) && $ previous != $ data ) { require_once ( $ CFG -> libdir . '/gradelib.php' ) ; grade_force_site_regrading ( ) ; } return $ result ; }
Saves the new setting.

@param mixed $data
@return string empty string or error message
Saves the new setting .