mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-49543 badges: minor tweaks
Fix restore to support old criteria not having descriptions. Plus delete not-needed cast (now $params is always already array).
This commit is contained in:
parent
89267d6a51
commit
7962f73e51
@ -2272,8 +2272,8 @@ class restore_badges_structure_step extends restore_structure_step {
|
||||
'badgeid' => $this->get_new_parentid('badge'),
|
||||
'criteriatype' => $data->criteriatype,
|
||||
'method' => $data->method,
|
||||
'description' => $data->description,
|
||||
'descriptionformat' => $data->descriptionformat,
|
||||
'description' => isset($data->description) ? $data->description : '',
|
||||
'descriptionformat' => isset($data->descriptionformat) ? $data->descriptionformat : 0,
|
||||
);
|
||||
$newid = $DB->insert_record('badge_criteria', $params);
|
||||
$this->set_mapping('criterion', $data->id, $newid);
|
||||
|
@ -373,7 +373,7 @@ abstract class award_criteria {
|
||||
|
||||
// Pick only params that are required by this criterion.
|
||||
// Filter out empty values first.
|
||||
$params = array_filter((array)$params);
|
||||
$params = array_filter($params);
|
||||
// Find out which param matches optional and required ones.
|
||||
$match = array_merge($this->optional_params, array($this->required_param));
|
||||
$regex = implode('|', array_map(create_function('$a', 'return $a . "_";'), $match));
|
||||
|
Loading…
x
Reference in New Issue
Block a user