Get the additional values to inject while exporting.

@param renderer_base $output The renderer.
@return array Keys are the property names, values are their values.
434669
protected function get_other_values(renderer_base $output) {
        $result = new \stdClass();
        $ancestors = [];
        $nodescount = count($this->related['ancestors']);
        $i = 1;
        $result->showlinks = \core_competency\api::show_links();
        foreach ($this->related['ancestors'] as $competency) {
            $exporter = new path_node_exporter([
                    'id' => $competency->get('id'),
                    'name' => $competency->get('idnumber'),
                    'position' => $i,
                    'first' => $i == 1,
                    'last' => $i == $nodescount
                ], [
                    'context' => $this->related['context'],
                ]
            );
            $ancestors[] = $exporter->export($output);
            $i++;
        }
        $result->ancestors = $ancestors;
        $exporter = new path_node_exporter([
                'id' => $this->related['framework']->get('id'),
                'name' => $this->related['framework']->get('shortname'),
                'first' => 0,
                'last' => 0,
                'position' => -1
            ], [
                'context' => $this->related['context']
            ]
        );
        $result->framework = $exporter->export($output);
        $result->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true);
        $result->pagecontextid = $this->related['context']->id;
        return (array) $result;
    }
112288
public function export_for_template(renderer_base $output) {
        $data = parent::export_for_template($output);
        $data->courseid = $this->course->id;
        return $data;
    }
1266910
public function export_for_template(\renderer_base $output) {

        $data = (object)[
            'statusicon' => '',
            'statustext' => '',
            'statuslink' => '',
            'actions' => [],
        ];

        if (count($this->versions) == 1) {
            // We represent one particular policy's agreement status.
            $versionname = reset($this->versions);
            $versionid = key($this->versions);

            $actionaccept = (object)[
                'text' => get_string('useracceptanceactionaccept', 'tool_policy'),
                'title' => get_string('useracceptanceactionacceptone', 'tool_policy', $versionname),
                'data' => 'acceptmodal',
                'url' => (new \moodle_url('/admin/tool/policy/accept.php', [
                    'userids[]' => $this->userid,
                    'versionids[]' => $versionid,
                    'action' => 'accept',
                    'returnurl' => $this->pageurl->out_as_local_url(false),
                ]))->out(false),
            ];

            $actionrevoke = (object)[
                'text' => get_string('useracceptanceactionrevoke', 'tool_policy'),
                'title' => get_string('useracceptanceactionrevokeone', 'tool_policy', $versionname),
                'data' => 'acceptmodal',
                'url' => (new \moodle_url('/admin/tool/policy/accept.php', [
                    'userids[]' => $this->userid,
                    'versionids[]' => $versionid,
                    'action' => 'revoke',
                    'returnurl' => $this->pageurl->out_as_local_url(false),
                ]))->out(false),
            ];

            $actiondecline = (object)[
                'text' => get_string('useracceptanceactiondecline', 'tool_policy'),
                'title' => get_string('useracceptanceactiondeclineone', 'tool_policy', $versionname),
                'data' => 'acceptmodal',
                'url' => (new \moodle_url('/admin/tool/policy/accept.php', [
                    'userids[]' => $this->userid,
                    'versionids[]' => $versionid,
                    'action' => 'decline',
                    'returnurl' => $this->pageurl->out_as_local_url(false),
                ]))->out(false),
            ];

            if ($this->accepted) {
                $data->statusicon = 'agreed';

                if ($this->onbehalf) {
                    $data->statustext = get_string('acceptancestatusacceptedbehalf', 'tool_policy');
                } else {
                    $data->statustext = get_string('acceptancestatusaccepted', 'tool_policy');
                }

                if ($this->canrevoke) {
                    $data->actions[] = $actionrevoke;
                }

            } else if ($this->declined) {
                $data->statusicon = 'declined';

                if ($this->onbehalf) {
                    $data->statustext = get_string('acceptancestatusdeclinedbehalf', 'tool_policy');
                } else {
                    $data->statustext = get_string('acceptancestatusdeclined', 'tool_policy');
                }

                if ($this->canaccept) {
                    $data->actions[] = $actionaccept;
                }

            } else {
                $data->statusicon = 'pending';
                $data->statustext = get_string('acceptancestatuspending', 'tool_policy');

                if ($this->canaccept) {
                    $data->actions[] = $actionaccept;
                    $data->actions[] = $actiondecline;
                }
            }

        } else if (count($this->versions) > 1) {
            // We represent the summary status for multiple policies.

            $data->actions[] = (object)[
                'text' => get_string('useracceptanceactiondetails', 'tool_policy'),
                'url' => (new \moodle_url('/admin/tool/policy/user.php', [
                    'userid' => $this->userid,
                    'returnurl' => $this->pageurl->out_as_local_url(false),
                ]))->out(false),
            ];

            // Prepare the action link to accept all pending policies.
            $accepturl = new \moodle_url('/admin/tool/policy/accept.php', [
                'userids[]' => $this->userid,
                'action' => 'accept',
                'returnurl' => $this->pageurl->out_as_local_url(false),
            ]);

            foreach (array_diff(array_keys($this->versions), $this->accepted, $this->declined) as $ix => $versionid) {
                $accepturl->param('versionids['.$ix.']', $versionid);
            }

            $actionaccept = (object)[
                'text' => get_string('useracceptanceactionaccept', 'tool_policy'),
                'title' => get_string('useracceptanceactionacceptpending', 'tool_policy'),
                'data' => 'acceptmodal',
                'url' => $accepturl->out(false),
            ];

            // Prepare the action link to revoke all agreed policies.
            $revokeurl = new \moodle_url('/admin/tool/policy/accept.php', [
                'userids[]' => $this->userid,
                'action' => 'revoke',
                'returnurl' => $this->pageurl->out_as_local_url(false),
            ]);

            foreach ($this->accepted as $ix => $versionid) {
                $revokeurl->param('versionids['.$ix.']', $versionid);
            }

            $actionrevoke = (object)[
                'text' => get_string('useracceptanceactionrevoke', 'tool_policy'),
                'title' => get_string('useracceptanceactionrevokeall', 'tool_policy'),
                'data' => 'acceptmodal',
                'url' => $revokeurl->out(false),
            ];

            // Prepare the action link to decline all pending policies.
            $declineurl = new \moodle_url('/admin/tool/policy/accept.php', [
                'userids[]' => $this->userid,
                'action' => 'decline',
                'returnurl' => $this->pageurl->out_as_local_url(false),
            ]);

            foreach (array_diff(array_keys($this->versions), $this->accepted, $this->declined) as $ix => $versionid) {
                $declineurl->param('versionids['.$ix.']', $versionid);
            }

            $actiondecline = (object)[
                'text' => get_string('useracceptanceactiondecline', 'tool_policy'),
                'title' => get_string('useracceptanceactiondeclinepending', 'tool_policy'),
                'data' => 'acceptmodal',
                'url' => $declineurl->out(false),
            ];

            $countversions = count($this->versions);
            $countaccepted = count($this->accepted);
            $countdeclined = count($this->declined);

            if ($countaccepted == $countversions) {
                // All policies accepted.
                $data->statusicon = 'agreed';
                $data->statustext = get_string('acceptancestatusaccepted', 'tool_policy');

                if ($this->canrevoke) {
                    $data->actions[] = $actionrevoke;
                }

            } else if ($countdeclined == $countversions) {
                // All policies declined.
                $data->statusicon = 'declined';
                $data->statustext = get_string('acceptancestatusdeclined', 'tool_policy');

            } else if ($countaccepted + $countdeclined == $countversions) {
                // All policies responded, only some of them accepted.
                $data->statusicon = 'partial';
                $data->statustext = get_string('acceptancestatuspartial', 'tool_policy');

                if ($this->accepted && $this->canrevoke) {
                    $data->actions[] = $actionrevoke;
                }

            } else {
                // Some policies are pending.
                $data->statusicon = 'pending';
                $data->statustext = get_string('acceptancestatuspending', 'tool_policy');

                if ($this->canaccept) {
                    $data->actions[] = $actionaccept;
                    $data->actions[] = $actiondecline;
                }
            }
        }

        return $data;
    }
1019296
protected function get_other_values(renderer_base $output) {
        $context = $this->related['context'];
        $endorsement = $this->related['endorsement'];
        $alignments = $this->related['alignments'];
        $relatedbadges = $this->related['relatedbadges'];

        $values = array(
            'badgeurl' => moodle_url::make_webservice_pluginfile_url($context->id, 'badges', 'badgeimage', $this->data->id, '/',
                'f1')->out(false),
            'alignments' => array(),
            'relatedbadges' => array(),
        );

        if ($endorsement) {
            $endorsementexporter = new endorsement_exporter($endorsement, array('context' => $context));
            $values['endorsement'] = $endorsementexporter->export($output);
        }

        if (!empty($alignments)) {
            foreach ($alignments as $alignment) {
                $alignmentexporter = new alignment_exporter($alignment, array('context' => $context));
                $values['alignments'][] = $alignmentexporter->export($output);
            }
        }

        if (!empty($relatedbadges)) {
            foreach ($relatedbadges as $badge) {
                $relatedexporter = new related_info_exporter($badge, array('context' => $context));
                $values['relatedbadges'][] = $relatedexporter->export($output);
            }
        }

        return $values;
    }
757886
public function export_for_template(renderer_base $output) {
        $tabs = [];
        $secondrow = false;

        foreach ($this->subtree as $tab) {
            $tabs[] = $tab->export_for_template($output);
            if (!empty($tab->subtree) && ($tab->level == 0 || $tab->selected || $tab->activated)) {
                $secondrow = new tabtree($tab->subtree);
            }
        }

        return (object) [
            'tabs' => $tabs,
            'secondrow' => $secondrow ? $secondrow->export_for_template($output) : false
        ];
    }
1312929
protected function get_other_values(renderer_base $output) {
        global $OUTPUT;

        return array(
                'viewurl' => (new moodle_url('/mod/'.$this->data->modname.'/view.php',
                        array('id' => $this->data->cmid)))->out(false),
                'courseviewurl' => (new moodle_url('/course/view.php', array('id' => $this->data->courseid)))->out(false),
                'icon' => $OUTPUT->image_icon('icon', get_string('pluginname', $this->data->modname), $this->data->modname)
        );
    }
392153
protected function get_day_names(renderer_base $output) {
        $weekdays = $this->related['type']->get_weekdays();
        $daysinweek = count($weekdays);

        $daynames = [];
        for ($i = 0; $i < $daysinweek; $i++) {
            // Bump the currentdayno and ensure it loops.
            $dayno = ($i + $this->firstdayofweek + $daysinweek) % $daysinweek;
            $dayname = new day_name_exporter($dayno, $weekdays[$dayno]);
            $daynames[] = $dayname->export($output);
        }

        return $daynames;
    }
22811
protected function get_other_values(\renderer_base $output) {
        $iconexporter = new question_icon_exporter($this->question, $this->related);

        return [
            'icon' => $iconexporter->export($output),
        ];
    }
930610
protected function get_other_values(renderer_base $output) {
        $values = [];

        $formattedbases = [];
        $lawfulbases = explode(',', $this->persistent->get('lawfulbases'));
        if (!empty($lawfulbases)) {
            foreach ($lawfulbases as $basis) {
                if (empty(trim($basis))) {
                    continue;
                }
                $formattedbases[] = (object)[
                    'name' => get_string($basis . '_name', 'tool_dataprivacy'),
                    'description' => get_string($basis . '_description', 'tool_dataprivacy')
                ];
            }
        }
        $values['formattedlawfulbases'] = $formattedbases;

        $formattedsensitivereasons = [];
        $sensitivereasons = explode(',', $this->persistent->get('sensitivedatareasons'));
        if (!empty($sensitivereasons)) {
            foreach ($sensitivereasons as $reason) {
                if (empty(trim($reason))) {
                    continue;
                }
                $formattedsensitivereasons[] = (object)[
                    'name' => get_string($reason . '_name', 'tool_dataprivacy'),
                    'description' => get_string($reason . '_description', 'tool_dataprivacy')
                ];
            }
        }
        $values['formattedsensitivedatareasons'] = $formattedsensitivereasons;

        $retentionperiod = $this->persistent->get('retentionperiod');
        if ($retentionperiod) {
            $formattedtime = \tool_dataprivacy\api::format_retention_period(new \DateInterval($retentionperiod));
        } else {
            $formattedtime = get_string('retentionperiodnotdefined', 'tool_dataprivacy');
        }
        $values['formattedretentionperiod'] = $formattedtime;

        $values['roleoverrides'] = !empty($this->persistent->get_purpose_overrides());

        return $values;
    }
143646
public function export_for_template(renderer_base $output) {

        $pixdata = $this->pixicon->export_for_template($output);

        $title = isset($this->pixicon->attributes['title']) ? $this->pixicon->attributes['title'] : '';
        $alt = isset($this->pixicon->attributes['alt']) ? $this->pixicon->attributes['alt'] : '';
        if (empty($title)) {
            $title = $alt;
        }
        $data = array(
            'extraclasses' => $pixdata['extraclasses'],
            'title' => $title,
            'alt' => $alt,
            'key' => $this->key
        );

        return $data;
    }
853977
public function export_for_template(\renderer_base $output) {
        $data = new \stdClass();
        $data->action = (new \moodle_url('/admin/tool/policy/acceptances.php'))->out(false);

        $data->filteroptions = [];
        $originalfilteroptions = [];
        list($avilablefilters, $selectedoptions) = $this->build_available_filters();
        foreach ($avilablefilters as $value => $label) {
            $selected = in_array($value, $selectedoptions);
            $filteroption = (object)[
                'value' => $value,
                'label' => $label
            ];
            $originalfilteroptions[] = $filteroption;
            $filteroption->selected = $selected;
            $data->filteroptions[] = $filteroption;
        }
        $data->originaloptionsjson = json_encode($originalfilteroptions);
        return $data;
    }
1091570
public function export_for_template(renderer_base $output) {
        $related = array(
            'context' => $this->framework->get_context(),
            'framework' => $this->framework,
            'linkedcourses' => $this->courses,
            'relatedcompetencies' => $this->relatedcompetencies,
            'competency' => $this->competency
        );

        $exporter = new competency_summary_exporter($this->competency, $related);
        $data = $exporter->export($output);

        return $data;
    }
311048
public function export_for_template(\renderer_base $output) {
        if ($this->value) {
            $this->edithint = get_string('disable');
            $this->displayvalue = $output->pix_icon('i/hide', get_string('disable'));
        } else {
            $this->edithint = get_string('enable');
            $this->displayvalue = $output->pix_icon('i/show', get_string('enable'));
        }

        return parent::export_for_template($output);
    }
1084528
public function export_for_template(renderer_base $output) {
        global $SITE, $CFG;

        $sitename = format_string($SITE->fullname);
        $supportname = $CFG->supportname;
        $supportemail = $CFG->supportemail;

        $context = [
            'sitename' => $sitename,
            'supportname' => $supportname,
            'supportemail' => $supportemail,
            'homelink' => new \moodle_url('/')
        ];

        return $context;
    }
631724
public function export_for_template(renderer_base $output) {
        global $SITE;

        $sitename = format_string($SITE->fullname);
        $formhtml = $this->form->render();
        $error = $this->errormessage;

        $context = [
            'sitename' => $sitename,
            'formhtml' => $formhtml,
            'error'    => $error
        ];

        return $context;
    }
496930
protected function get_other_values(renderer_base $output) {
        $values = parent::get_other_values($output);

        global $CFG;
        require_once($CFG->dirroot.'/course/lib.php');

        $event = $this->event;
        $context = $this->related['context'];
        if ($moduleproxy = $event->get_course_module()) {
            $modulename = $moduleproxy->get('modname');
            $moduleid = $moduleproxy->get('id');
            $url = new \moodle_url(sprintf('/mod/%s/view.php', $modulename), ['id' => $moduleid]);

            // Build edit event url for action events.
            $params = array('update' => $moduleid, 'return' => true, 'sesskey' => sesskey());
            $editurl = new \moodle_url('/course/mod.php', $params);
            $values['editurl'] = $editurl->out(false);
        } else if ($event->get_type() == 'category') {
            $url = $event->get_category()->get_proxied_instance()->get_view_link();
        } else if ($event->get_type() == 'course') {
            $url = \course_get_url($this->related['course'] ?: SITEID);
        } else {
            // TODO MDL-58866 We do not have any way to find urls for events outside of course modules.
            $url = \course_get_url($this->related['course'] ?: SITEID);
        }
        $values['url'] = $url->out(false);

        // Override default formatted time to make sure the date portion of the time is always rendered.
        $legacyevent = container::get_event_mapper()->from_event_to_legacy_event($event);
        $values['formattedtime'] = calendar_format_event_time($legacyevent, time(), null, false);

        if ($event instanceof action_event_interface) {
            $actionrelated = [
                'context' => $context,
                'event' => $event
            ];
            $actionexporter = new event_action_exporter($event->get_action(), $actionrelated);
            $values['action'] = $actionexporter->export($output);
        }



        return $values;
    }
1371638
public function export_for_template(\renderer_base $output) {
        $value = $this->get_value();
        return (object)[
            'value' => $value,
            'type' => $this->get_type(),
            'shortname' => $this->get_shortname(),
            'name' => $this->get_name(),
            'hasvalue' => ($value !== null),
            'instanceid' => $this->data->get('instanceid')
        ];
    }