Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
d95ad08f
Commit
d95ad08f
authored
Oct 22, 2018
by
Andrew Nicols
Browse files
MDL-63619 tool_dataprivacy: Cache purposes in form
parent
3b002c86
Changes
1
Hide whitespace changes
Inline
Side-by-side
admin/tool/dataprivacy/classes/form/context_instance.php
View file @
d95ad08f
...
...
@@ -145,12 +145,12 @@ class context_instance extends \core\form\persistent {
$persistent
->
set
(
'contextid'
,
$context
->
id
);
}
$purpose
options
=
\
tool_dataprivacy\output\data_registry_page
::
purpose_options
(
api
::
get_purposes
()
)
;
$categoryoptions
=
\
tool_dataprivacy\output\data_registry_page
::
category_options
(
api
::
get_categories
()
);
$purpose
s
=
[];
foreach
(
api
::
get_purposes
()
as
$purpose
)
{
$purposes
[
$purpose
->
get
(
'id'
)]
=
$purpose
;
}
$purposeoptions
=
\
tool_dataprivacy\output\data_registry_page
::
purpose_options
(
$purposes
);
$categoryoptions
=
\
tool_dataprivacy\output\data_registry_page
::
category_options
(
api
::
get_categories
()
);
$customdata
=
[
'context'
=>
$context
,
...
...
@@ -168,9 +168,14 @@ class context_instance extends \core\form\persistent {
$context
);
$customdata
[
'purposeretentionperiods'
]
=
[];
foreach
(
$purposeoptions
as
$optionvalue
=>
$unused
)
{
// Get the effective purpose if $optionvalue would be the selected value.
$purpose
=
api
::
get_effective_context_purpose
(
$context
,
$optionvalue
);
foreach
(
array_keys
(
$purposeoptions
)
as
$optionvalue
)
{
if
(
isset
(
$purposes
[
$optionvalue
]))
{
$purpose
=
$purposes
[
$optionvalue
];
}
else
{
// Get the effective purpose if $optionvalue would be the selected value.
$purpose
=
api
::
get_effective_context_purpose
(
$context
,
$optionvalue
);
}
$retentionperiod
=
self
::
get_retention_display_text
(
$purpose
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment