Export this data so it can be used as the context for a mustache template.

@param \renderer_base $output
@return stdClass
777
public function export_for_template(renderer_base $output) {
        global $USER, $OUTPUT;

        $data = new \stdClass();

        if (!isset($this->config->display_picture) || $this->config->display_picture == 1) {
            $data->userpicture = $OUTPUT->user_picture($USER, array('class' => 'userpicture'));
        }

        $data->userfullname = fullname($USER);

        if (!isset($this->config->display_country) || $this->config->display_country == 1) {
            $countries = get_string_manager()->get_list_of_countries(true);
            if (isset($countries[$USER->country])) {
                $data->usercountry = $countries[$USER->country];
            }
        }

        if (!isset($this->config->display_city) || $this->config->display_city == 1) {
            $data->usercity = $USER->city;
        }

        if (!isset($this->config->display_email) || $this->config->display_email == 1) {
            $data->useremail = obfuscate_mailto($USER->email, '');
        }

        if (!empty($this->config->display_icq) && !empty($USER->icq)) {
            $data->usericq = s($USER->icq);
        }

        if (!empty($this->config->display_skype) && !empty($USER->skype)) {
            $data->userskype = s($USER->skype);
        }

        if (!empty($this->config->display_yahoo) && !empty($USER->yahoo)) {
            $data->useryahoo = s($USER->yahoo);
        }

        if (!empty($this->config->display_aim) && !empty($USER->aim)) {
            $data->useraim = s($USER->aim);
        }

        if (!empty($this->config->display_msn) && !empty($USER->msn)) {
            $data->usermsn = s($USER->msn);
        }

        if (!empty($this->config->display_phone1) && !empty($USER->phone1)) {
            $data->userphone1 = s($USER->phone1);
        }

        if (!empty($this->config->display_phone2) && !empty($USER->phone2)) {
            $data->userphone2 = s($USER->phone2);
        }

        if (!empty($this->config->display_institution) && !empty($USER->institution)) {
            $data->userinstitution = format_string($USER->institution);
        }

        if (!empty($this->config->display_address) && !empty($USER->address)) {
            $data->useraddress = format_string($USER->address);
        }

        if (!empty($this->config->display_firstaccess) && !empty($USER->firstaccess)) {
            $data->userfirstaccess = userdate($USER->firstaccess);
        }

        if (!empty($this->config->display_lastaccess) && !empty($USER->lastaccess)) {
            $data->userlastaccess = userdate($USER->lastaccess);
        }

        if (!empty($this->config->display_currentlogin) && !empty($USER->currentlogin)) {
            $data->usercurrentlogin = userdate($USER->currentlogin);
        }

        if (!empty($this->config->display_lastip) && !empty($USER->lastip)) {
            $data->userlastip = $USER->lastip;
        }

        return $data;
    }
325811
public function export_for_template(\renderer_base $output) {
        $data = array('feeds' => array());

        foreach ($this->feeds as $feed) {
            $data['feeds'][] = $feed->export_for_template($output);
        }

        return $data;
    }
107907
public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $data->userid = $this->userid;
        $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true);
        $data->canmanage = $this->canmanage;

        $data->evidence = array();
        if ($this->evidence) {
            foreach ($this->evidence as $evidence) {
                $userevidencesummaryexporter = new user_evidence_summary_exporter($evidence, array(
                    'context' => $this->context
                ));
                $data->evidence[] = $userevidencesummaryexporter->export($output);
            }
        }

        $data->navigation = array();
        foreach ($this->navigation as $button) {
            $data->navigation[] = $output->render($button);
        }

        return $data;
    }
1343151
public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $data->uninstallurl = $this->uninstallurl;
        $data->sesskey = sesskey();

        $data->installedoptions = [];
        foreach ($this->installedlanguages as $code => $language) {
            $option = new stdClass();
            $option->value = $code;
            $option->text = $language;
            $data->installedoptions[] = $option;
        }

        $data->updateurl = $this->updateurl;

        if (!empty($this->availablelanguages)) {
            $data->toinstalloptions = [];
            foreach ($this->availablelanguages as $code => $language) {
                $option = new stdClass();
                $option->value = $code;
                $option->text = $language;
                $data->toinstalloptions[] = $option;
            }
            $data->installurl = $this->installurl;
            $data->caninstall = true;
        }

        return $data;
    }
957464
public function export_for_template(renderer_base $output) {
        ob_start();
        $this->display();
        $formhtml = ob_get_contents();
        ob_end_clean();
        $context = [
            'formhtml' => $formhtml
        ];
        return $context;
    }
345772
public function export_for_template(renderer_base $output) {
        global $PAGE;

        $params = [\context_system::instance()->id, $this->defaultcontextlevel, $this->defaultcontextid];
        $PAGE->requires->js_call_amd('tool_dataprivacy/data_registry', 'init', $params);

        $data = new stdClass();
        $defaultsbutton = new \action_link(
            new \moodle_url('/admin/tool/dataprivacy/defaults.php'),
            get_string('setdefaults', 'tool_dataprivacy'),
            null,
            ['class' => 'btn btn-primary']
        );
        $data->defaultsbutton = $defaultsbutton->export_for_template($output);

        $actionmenu = new \action_menu();
        $actionmenu->set_menu_trigger(get_string('edit'), 'btn btn-primary');
        $actionmenu->set_owner_selector('dataregistry-actions');
        $actionmenu->set_alignment(\action_menu::TL, \action_menu::BL);

        $url = new \moodle_url('/admin/tool/dataprivacy/categories.php');
        $categories = new \action_menu_link_secondary($url, null, get_string('categories', 'tool_dataprivacy'));
        $actionmenu->add($categories);

        $url = new \moodle_url('/admin/tool/dataprivacy/purposes.php');
        $purposes = new \action_menu_link_secondary($url, null, get_string('purposes', 'tool_dataprivacy'));
        $actionmenu->add($purposes);

        $data->actions = $actionmenu->export_for_template($output);

        if (!data_registry::defaults_set()) {
            $data->info = (object)[
                    'message' => get_string('dataregistryinfo', 'tool_dataprivacy'),
                    'announce' => 1
            ];
            $data->nosystemdefaults = (object)[
                'message' => get_string('nosystemdefaults', 'tool_dataprivacy'),
                'announce' => 1
            ];
        }

        $data->tree = $this->get_default_tree_structure();

        return $data;
    }
242218
public function export_for_template(renderer_base $output) {
        global $CFG;

        $title = get_string($this->identifier, $this->component);

        if (empty($this->linktext)) {
            $alt = get_string('helpprefix2', '', trim($title, ". \t"));
        } else {
            $alt = get_string('helpwiththis');
        }

        $data = get_formatted_help_string($this->identifier, $this->component, false);

        $data->alt = $alt;
        $data->icon = (new pix_icon('help', $alt, 'core', ['class' => 'iconhelp']))->export_for_template($output);
        $data->linktext = $this->linktext;
        $data->title = get_string('helpprefix2', '', trim($title, ". \t"));

        $options = [
            'component' => $this->component,
            'identifier' => $this->identifier,
            'lang' => current_language()
        ];

        // Debugging feature lets you display string identifier and component.
        if (isset($CFG->debugstringids) && $CFG->debugstringids && optional_param('strings', 0, PARAM_INT)) {
            $options['strings'] = 1;
        }

        $data->url = (new moodle_url('/help.php', $options))->out(false);
        $data->ltr = !right_to_left();
        return $data;
    }
533075
public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $data->template = (new template_exporter($this->template))->export($output);
        $data->pagecontextid = $this->pagecontext->id;
        $data->competencies = array();
        $helper = new performance_helper();
        foreach ($this->competencies as $competency) {
            $context = $helper->get_context_from_competency($competency);
            $framework = $helper->get_framework_from_competency($competency);

            $courses = api::list_courses_using_competency($competency->get('id'));
            $relatedcompetencies = api::list_related_competencies($competency->get('id'));

            $related = array(
                'competency' => $competency,
                'linkedcourses' => $courses,
                'context' => $context,
                'relatedcompetencies' => $relatedcompetencies,
                'framework' => $framework
            );
            $exporter = new competency_summary_exporter(null, $related);
            $record = $exporter->export($output);

            array_push($data->competencies, $record);
        }

        $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(false);
        $data->canmanagecompetencyframeworks = $this->canmanagecompetencyframeworks;
        $data->canmanagetemplatecompetencies = $this->canmanagetemplatecompetencies;
        $data->manageurl = $this->manageurl->out(true);
        $exporter = new template_statistics_exporter($this->templatestatistics);
        $data->statistics = $exporter->export($output);
        $data->showcompetencylinks = true;

        return $data;
    }
444352
public function export_for_template(renderer_base $output) {
        if (!isset($related['user'])) {
            $related['user'] = core_user::get_user($this->usercompetency->get('userid'));
        }
        if (!isset($related['competency'])) {
            $related['competency'] = $this->usercompetency->get_competency();
        }

        $related += array(
            'usercompetency' => $this->usercompetency,
            'usercompetencyplan' => null,
            'usercompetencycourse' => null,
            'evidence' => api::list_evidence($this->usercompetency->get('userid'), $this->usercompetency->get('competencyid')),
            'relatedcompetencies' => api::list_related_competencies($this->usercompetency->get('competencyid'))
        );
        $exporter = new user_competency_summary_exporter(null, $related);
        $data = $exporter->export($output);

        return $data;
    }
154868
public function export_for_template(renderer_base $output) {

        $nocoursesurl = $output->image_url('courses', 'block_myoverview')->out();

        $defaultvariables = [
            'nocoursesimg' => $nocoursesurl,
            'grouping' => $this->grouping,
            'sort' => $this->sort == BLOCK_MYOVERVIEW_SORTING_TITLE ? 'fullname' : 'ul.timeaccess desc',
            'view' => $this->view,
            'paging' => $this->paging,
            'displaycategories' => $this->displaycategories,
        ];

        $preferences = $this->get_preferences_as_booleans();
        return array_merge($defaultvariables, $preferences);

    }
689814
public function export_for_template(renderer_base $output) {
        $data = new stdClass();

        $data->actionurl = $this->actionurl->out(false);
        $data->instructions = (string) $this->instructions;
        $data->method = $this->method;
        $data->paramname = $this->paramname;
        $data->params = $this->params;
        $data->sesskey = sesskey();
        $data->title = (string) $this->title;

        $data->sections = array_map(function($section) use ($output) {
            return $section->export_for_template($output);
        }, $this->sections);

        return $data;
    }
803209
public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $data->id = $this->id;
        $data->label = $this->label;
        $data->value = $this->value;
        $data->icon = $this->icon->export_for_template($output);

        $options = new stdClass();
        $options->trusted = false;
        $options->noclean = false;
        $options->smiley = false;
        $options->filter = false;
        $options->para = true;
        $options->newlines = false;
        $options->overflowdiv = false;

        $data->description = '';
        if (!empty($this->description)) {
            list($data->description) = external_format_text((string) $this->description, FORMAT_MARKDOWN,
                $this->context->id, null, null, null, $options);
        }

        return $data;
    }
869774
public function export_for_template(\renderer_base $output) {
        global $DB;
        $data = new stdClass();

        $missingmappings = $this->processor->get_missing_mappings();

        $data->pagecontextid = $this->pagecontext->id;
        $data->expectedccmigrations = $this->processor->get_expected_course_competency_migrations();
        $data->expectedmcmigrations = $this->processor->get_expected_module_competency_migrations();
        $data->ccmigrationscount = $this->processor->get_course_competency_migrations();
        $data->mcmigrationscount = $this->processor->get_module_competency_migrations();
        $data->ccremovalscount = $this->processor->get_course_competency_removals();
        $data->mcremovalscount = $this->processor->get_module_competency_removals();

        $data->unmappedfrom = array();
        $data->unmappedto = array();

        $exporter = new competency_framework_exporter($this->frameworkfrom);
        $data->frameworkfrom = $exporter->export($output);
        $exporter = new competency_framework_exporter($this->frameworkto);
        $data->frameworkto = $exporter->export($output);

        $fromcontext = $this->frameworkfrom->get_context();
        $tocontext = $this->frameworkto->get_context();

        $compcontext = null;
        foreach ($this->unmappedfrom as $comp) {
            $exporter = new competency_exporter($comp, array('context' => $fromcontext));
            $data->unmappedfrom[] = $exporter->export($output);
        }

        foreach ($this->unmappedto as $comp) {
            $exporter = new competency_exporter($comp, array('context' => $tocontext));
            $data->unmappedto[] = $exporter->export($output);
        }

        $data->coursesfound = $this->processor->get_courses_found_count();
        $data->cmsfound = $this->processor->get_cms_found_count();
        $data->mappingsmissingcount = count($missingmappings);
        $data->hasunmappedto = count($data->unmappedto) > 0;
        $data->hasunmappedfrom = count($data->unmappedfrom) > 0;
        $warnings = $this->processor->get_warnings();
        $data->warnings = array();
        $data->warningcount = count($warnings);
        $errors = $this->processor->get_errors();
        $data->errors = array();
        $data->errorcount = count($errors);

        foreach ($warnings as $warning) {
            $cmcontext = !empty($warning['cmid']) ? context_module::instance($warning['cmid']) : null;
            $coursecontext = context_course::instance($warning['courseid']);
            $warning['cm'] = $cmcontext ? $cmcontext->get_context_name() : null;
            $warning['course'] = $coursecontext->get_context_name();
            $warning['competency'] = $DB->get_field(competency::TABLE, 'idnumber', array('id' => $warning['competencyid']));
            $data->warnings[] = $warning;
        }

        foreach ($errors as $error) {
            $cmcontext = !empty($error['cmid']) ? context_module::instance($error['cmid']) : null;
            $coursecontext = context_course::instance($error['courseid']);
            $error['cm'] = $cmcontext ? $cmcontext->get_context_name() : null;
            $error['course'] = $coursecontext->get_context_name();
            $error['competency'] = $DB->get_field(competency::TABLE, 'idnumber', array('id' => $error['competencyid']));
            $data->errors[] = $error;
        }

        $data->pluginbaseurl = (new moodle_url('/admin/tool/lpmigrate'))->out(false);
        $data->frameworksurl = url::frameworks($this->pagecontext->id)->out(false);

        return $data;
    }
970576
public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $data->competencyframeworks = array();
        $data->pagecontextid = $this->pagecontext->id;
        foreach ($this->competencyframeworks as $framework) {
            $exporter = new competency_framework_exporter($framework);
            $data->competencyframeworks[] = $exporter->export($output);
        }
        $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true);
        $data->navigation = array();
        foreach ($this->navigation as $button) {
            $data->navigation[] = $output->render($button);
        }

        return $data;
    }
966519
public function export_for_template(\renderer_base $output) {
        $listofroles = [];
        $roleids = json_decode($this->value);
        $viewableroleids = array_intersect($roleids, array_merge($this->viewableroles, $this->assignableroles));

        foreach ($viewableroleids as $id) {
            // If this is a student, we only show a subset of the roles.
            if ($this->editable || array_key_exists($id, $this->profileroles)) {
                $listofroles[] = format_string($this->courseroles[$id]->localname, true, ['context' => $this->context]);
            }
        }

        if (!empty($listofroles)) {
            $this->displayvalue = implode($listofroles, ', ');
        } else if (!empty($roleids) && empty($viewableroleids)) {
            $this->displayvalue = get_string('novisibleroles', 'role');
        } else {
            $this->displayvalue = get_string('noroles', 'role');
        }
        return parent::export_for_template($output);
    }
1091964
public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $data->previous = null;
        $data->next = null;
        $data->first = null;
        $data->last = null;
        $data->label = get_string('page');
        $data->pages = [];
        $data->haspages = $this->totalcount > $this->perpage;

        if (!$data->haspages) {
            return $data;
        }

        if ($this->page > 0) {
            $data->previous = [
                'page' => $this->page - 1,
                'url' => (new moodle_url($this->baseurl, [$this->pagevar => $this->page - 1]))->out(false)
            ];
        }

        $currpage = 0;
        if ($this->page > round(($this->maxdisplay / 3) * 2)) {
            $currpage = $this->page - round($this->maxdisplay / 3);
            $data->first = [
                'page' => 1,
                'url' => (new moodle_url($this->baseurl, [$this->pagevar => 0]))->out(false)
            ];
        }

        $lastpage = 1;
        if ($this->perpage > 0) {
            $lastpage = ceil($this->totalcount / $this->perpage);
        }

        $displaycount = 0;
        $displaypage = 0;
        while ($displaycount < $this->maxdisplay and $currpage < $lastpage) {
            $displaypage = $currpage + 1;

            $iscurrent = $this->page == $currpage;
            $link = new moodle_url($this->baseurl, [$this->pagevar => $currpage]);

            $data->pages[] = [
                'page' => $displaypage,
                'active' => $iscurrent,
                'url' => $iscurrent ? null : $link->out(false)
            ];

            $displaycount++;
            $currpage++;
        }

        if ($currpage < $lastpage) {
            $data->last = [
                'page' => $lastpage,
                'url' => (new moodle_url($this->baseurl, [$this->pagevar => $lastpage - 1]))->out(false)
            ];
        }

        if ($this->page + 1 != $lastpage) {
            $data->next = [
                'page' => $this->page + 1,
                'url' => (new moodle_url($this->baseurl, [$this->pagevar => $this->page + 1]))->out(false)
            ];
        }

        return $data;
    }
1103766
public function export_for_template(\renderer_base $output) {
        $data = new stdClass();

        $userevidencesummaryexporter = new user_evidence_summary_exporter($this->userevidence, array(
            'context' => $this->context));
        $data->userevidence = $userevidencesummaryexporter->export($output);
        $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true);

        return $data;
    }