-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
-
2.5.1
-
None
-
MOODLE_25_STABLE
In a complex synchronization scenario I had to push new grades from moodle to a web service...
To achieve it I added some code to /lib/grade/grade_grade.php in the update function like this...
public function update($source=null) {
|
$this->rawgrade = grade_floatval($this->rawgrade);
|
$this->finalgrade = grade_floatval($this->finalgrade);
|
$this->rawgrademin = grade_floatval($this->rawgrademin);
|
$this->rawgrademax = grade_floatval($this->rawgrademax);
|
|
////<grades_export event trigger
|
$grade_to_update = new stdClass();
|
|
$grade_to_update->courseid = $this->grade_item->courseid;
|
$grade_to_update->userid = $this->userid;
|
$grade_to_update->itemid = $this->grade_item->id;
|
$grade_to_update->finalgrade = $this->finalgrade;
|
|
events_trigger('grade_changed', $grade_to_update);
|
////>
|
|
return parent::update($source);
|
}
|
This few lines made my life easy (as I was able to add a local plugin to handle this event and call the web service), and I thought that it should be added to the common code-base...
- duplicates
-
MDL-40697 Add events for when a grade has been created/updated
- Closed