Skip to content

Commit

Permalink
add procession functins
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed Mar 11, 2024
1 parent 43ef13a commit 6aeff86
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@
*/
class mod_moodleoverflow_mod_form extends moodleform_mod {

/**
* constructor
* @see moodleform_mod::moodleform_mod
*/
public function __construct($current, $section, $cm, $course) {
// Pre parse mod data if exists (in case not new).
if ($current && property_exists($current, 'setting')) {
$strategyoptions = json_decode($current->setting, true);
foreach ($strategyoptions as $stratkey => $strategy) {
foreach ($strategy as $key => $option) {
$current->{$this->get_settingsfield_identifier($stratkey, $key)} = $option;
}
}
}
parent::__construct($current, $section, $cm, $course);
}
/**
* Defines forms elements.
*/
Expand Down Expand Up @@ -249,4 +265,25 @@ public function data_postprocessing($data) {
$data->coursewidereputation = false;
}
}

public function get_data() {
$data = parent::get_data();
if ($data) {
$itemname = 'moodleoverflow';
$component = 'mod_moodleoverflow';
$gradepassfieldname = component_gradeitems::get_field_name_for_itemname($component, $itemname, 'gradepass');

// Convert the grade pass value - we may be using a language which uses commas,
// rather than decimal points, in numbers. These need to be converted so that
// they can be added to the DB.
if (isset($data->{$gradepassfieldname})) {
$data->{$gradepassfieldname} = unformat_float($data->{$gradepassfieldname});
}
}

return $data;
}
public function data_preprocessing(&$default_values) {
parent::data_preprocessing($default_values);
}
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'mod_moodleoverflow';
$plugin->version = 2023082500;
$plugin->version = 2024031104;
$plugin->release = 'v4.2-r4';
$plugin->requires = 2020061500; // Requires Moodle 3.9+.
$plugin->maturity = MATURITY_STABLE;
Expand Down

0 comments on commit 6aeff86

Please sign in to comment.