MDL-65033 mod_forum: Pass the favourites into the exporter

Query and pass the favouriting information into the exporter instead of within the exporter itself
This commit is contained in:
Peter 2019-03-25 08:16:14 +08:00 committed by Peter
parent 8885cd573a
commit 13cd05ac14
22 changed files with 268 additions and 112 deletions

View file

@ -79,14 +79,16 @@ abstract class exporter {
}
$missingdataerr = 'Exporter class is missing required related data: (' . get_called_class() . ') ';
$scalartypes = ['string', 'int', 'bool', 'float'];
$scalarcheck = 'is_' . $classname;
if ($nullallowed && array_key_exists($key, $related) && $related[$key] === null) {
$this->related[$key] = $related[$key];
if ($nullallowed && (!array_key_exists($key, $related) || $related[$key] === null)) {
$this->related[$key] = null;
} else if ($isarray) {
if (array_key_exists($key, $related) && is_array($related[$key])) {
foreach ($related[$key] as $index => $value) {
if (!$value instanceof $classname) {
if (!$value instanceof $classname && !$scalarcheck($value)) {
throw new coding_exception($missingdataerr . $key . ' => ' . $classname . '[]');
}
}
@ -96,8 +98,6 @@ abstract class exporter {
}
} else {
$scalartypes = ['string', 'int', 'bool', 'float'];
$scalarcheck = 'is_' . $classname;
if (array_key_exists($key, $related) &&
((in_array($classname, $scalartypes) && $scalarcheck($related[$key])) ||
($related[$key] instanceof $classname))) {

View file

@ -356,6 +356,7 @@ class icon_system_fontawesome extends icon_system_font {
'core:t/edit' => 'fa-cog',
'core:t/emailno' => 'fa-ban',
'core:t/email' => 'fa-envelope-o',
'core:t/emptystar' => 'fa-star-o',
'core:t/enrolusers' => 'fa-user-plus',
'core:t/expanded' => 'fa-caret-down',
'core:t/go' => 'fa-play',