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.
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;
    }
953943
protected function get_other_values(renderer_base $output) {
        $return = parent::get_other_values($output);

        if ($popovertitle = $this->get_popover_title()) {
            $return['popovertitle'] = $popovertitle;
        }

        return $return;
    }
435803
public function export_for_template(\renderer_base $output) {
        if (!$this->editable) {
            return array(
                'displayvalue' => (string)$this->displayvalue
            );
        }

        return array(
            'component' => $this->component,
            'itemtype' => $this->itemtype,
            'itemid' => $this->itemid,
            'displayvalue' => (string)$this->displayvalue,
            'value' => (string)$this->value,
            'edithint' => (string)$this->edithint,
            'editlabel' => (string)$this->editlabel,
            'type' => $this->type,
            'options' => $this->options,
            'linkeverything' => $this->get_linkeverything() ? 1 : 0,
        );
    }
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;
    }
926940
public function export_for_template(renderer_base $output) {
        global $DB;

        $usercompetencycourse = api::get_user_competency_in_course($this->courseid, $this->userid, $this->competencyid);
        $competency = $usercompetencycourse->get_competency();
        if (empty($usercompetencycourse) || empty($competency)) {
            throw new \invalid_parameter_exception('Invalid params. The competency does not belong to the course.');
        }

        $relatedcompetencies = api::list_related_competencies($competency->get('id'));
        $user = $DB->get_record('user', array('id' => $this->userid));
        $evidence = api::list_evidence_in_course($this->userid, $this->courseid, $this->competencyid);
        $course = $DB->get_record('course', array('id' => $this->courseid));

        $params = array(
            'competency' => $competency,
            'usercompetencycourse' => $usercompetencycourse,
            'evidence' => $evidence,
            'user' => $user,
            'course' => $course,
            'scale' => $competency->get_scale(),
            'relatedcompetencies' => $relatedcompetencies
        );
        $exporter = new user_competency_summary_in_course_exporter(null, $params);
        $data = $exporter->export($output);

        return $data;
    }
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)
        );
    }
244153
protected function get_other_values(renderer_base $output) {
        $values = [];
        $event = $this->event;
        $legacyevent = container::get_event_mapper()->from_event_to_legacy_event($event);
        $context = $this->related['context'];
        $course = $this->related['course'];
        $values['isactionevent'] = false;
        $values['iscourseevent'] = false;
        $values['iscategoryevent'] = false;
        $values['normalisedeventtype'] = $event->get_type();
        if ($moduleproxy = $event->get_course_module()) {
            // We need a separate property to flag if an event is action event.
            // That's required because canedit return true but action action events cannot be edited on the calendar UI.
            // But they are considered editable because you can drag and drop the event on the month view.
            $values['isactionevent'] = true;
            // Activity events are normalised to "look" like course events.
            $values['normalisedeventtype'] = 'course';
        } else if ($event->get_type() == 'course') {
            $values['iscourseevent'] = true;
        } else if ($event->get_type() == 'category') {
            $values['iscategoryevent'] = true;
        }
        $timesort = $event->get_times()->get_sort_time()->getTimestamp();
        $iconexporter = new event_icon_exporter($event, ['context' => $context]);
        $values['normalisedeventtypetext'] = get_string('type' . $values['normalisedeventtype'], 'calendar');

        $values['icon'] = $iconexporter->export($output);

        $subscriptionexporter = new event_subscription_exporter($event);
        $values['subscription'] = $subscriptionexporter->export($output);

        $proxy = $this->event->get_category();
        if ($proxy && $proxy->get('id')) {
            $category = $proxy->get_proxied_instance();
            $categorysummaryexporter = new coursecat_summary_exporter($category, ['context' => $context]);
            $values['category'] = $categorysummaryexporter->export($output);
        }

        if ($course) {
            $coursesummaryexporter = new course_summary_exporter($course, ['context' => $context]);
            $values['course'] = $coursesummaryexporter->export($output);
        }

        $courseid = (!$course) ? SITEID : $course->id;

        $values['canedit'] = calendar_edit_event_allowed($legacyevent, true);
        $values['candelete'] = calendar_delete_event_allowed($legacyevent);

        $deleteurl = new moodle_url('/calendar/delete.php', ['id' => $event->get_id(), 'course' => $courseid]);
        $values['deleteurl'] = $deleteurl->out(false);

        $editurl = new moodle_url('/calendar/event.php', ['action' => 'edit', 'id' => $event->get_id(),
                'course' => $courseid]);
        $values['editurl'] = $editurl->out(false);
        $viewurl = new moodle_url('/calendar/view.php', ['view' => 'day', 'course' => $courseid,
                'time' => $timesort]);
        $viewurl->set_anchor('event_' . $event->get_id());
        $values['viewurl'] = $viewurl->out(false);
        $values['formattedtime'] = calendar_format_event_time($legacyevent, time(), null, false,
                $timesort);

        if ($group = $event->get_group()) {
            $values['groupname'] = format_string($group->get('name'), true,
                ['context' => \context_course::instance($event->get_course()->get('id'))]);
        }

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

        $keyhelp = new help_icon('resourcekey', 'mod_lti');
        $secrethelp = new help_icon('password', 'mod_lti');

        $url = new moodle_url('/mod/lti/typessettings.php', array('sesskey' => sesskey(), 'returnto' => 'toolconfigure'));
        $data->configuremanualurl = $url->out();
        $url = new moodle_url('/admin/settings.php?section=modsettinglti');
        $data->managetoolsurl = $url->out();
        $url = new moodle_url('/mod/lti/toolproxies.php');
        $data->managetoolproxiesurl = $url->out();
        $data->keyhelp = $keyhelp->export_for_template($output);
        $data->secrethelp = $secrethelp->export_for_template($output);
        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;
    }
584318
public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $attributes = $this->attributes;
        $attributesprimary = $this->attributesprimary;
        $attributessecondary = $this->attributessecondary;

        $data->instance = $this->instance;

        $data->classes = isset($attributes['class']) ? $attributes['class'] : '';
        unset($attributes['class']);

        $data->attributes = array_map(function($key, $value) {
            return [ 'name' => $key, 'value' => $value ];
        }, array_keys($attributes), $attributes);

        $primary = new stdClass();
        $primary->title = '';
        $primary->prioritise = $this->prioritise;

        $primary->classes = isset($attributesprimary['class']) ? $attributesprimary['class'] : '';
        unset($attributesprimary['class']);
        $primary->attributes = array_map(function($key, $value) {
            return [ 'name' => $key, 'value' => $value ];
        }, array_keys($attributesprimary), $attributesprimary);

        $actionicon = $this->actionicon;
        if (!empty($this->menutrigger)) {
            $primary->menutrigger = $this->menutrigger;
            $primary->triggerextraclasses = $this->triggerextraclasses;
            if ($this->actionlabel) {
                $primary->title = $this->actionlabel;
            } else if ($this->actiontext) {
                $primary->title = $this->actiontext;
            } else {
                $primary->title = strip_tags($this->menutrigger);
            }
        } else {
            $primary->title = get_string('actionsmenu');
            $iconattributes = ['class' => 'iconsmall actionmenu', 'title' => $primary->title];
            $actionicon = new pix_icon('t/edit_menu', '', 'moodle', $iconattributes);
        }

        if ($actionicon instanceof pix_icon) {
            $primary->icon = $actionicon->export_for_pix();
            if (!empty($actionicon->attributes['alt'])) {
                $primary->title = $actionicon->attributes['alt'];
            }
        } else {
            $primary->iconraw = $actionicon ? $output->render($actionicon) : '';
        }

        $primary->actiontext = $this->actiontext ? (string) $this->actiontext : '';
        $primary->items = array_map(function($item) use ($output) {
            $data = (object) [];
            if ($item instanceof action_menu_link) {
                $data->actionmenulink = $item->export_for_template($output);
            } else if ($item instanceof action_menu_filler) {
                $data->actionmenufiller = $item->export_for_template($output);
            } else if ($item instanceof action_link) {
                $data->actionlink = $item->export_for_template($output);
            } else if ($item instanceof pix_icon) {
                $data->pixicon = $item->export_for_template($output);
            } else {
                $data->rawhtml = ($item instanceof renderable) ? $output->render($item) : $item;
            }
            return $data;
        }, $this->primaryactions);

        $secondary = new stdClass();
        $secondary->classes = isset($attributessecondary['class']) ? $attributessecondary['class'] : '';
        unset($attributessecondary['class']);
        $secondary->attributes = array_map(function($key, $value) {
            return [ 'name' => $key, 'value' => $value ];
        }, array_keys($attributessecondary), $attributessecondary);
        $secondary->items = array_map(function($item) use ($output) {
            $data = (object) [];
            if ($item instanceof action_menu_link) {
                $data->actionmenulink = $item->export_for_template($output);
            } else if ($item instanceof action_menu_filler) {
                $data->actionmenufiller = $item->export_for_template($output);
            } else if ($item instanceof action_link) {
                $data->actionlink = $item->export_for_template($output);
            } else if ($item instanceof pix_icon) {
                $data->pixicon = $item->export_for_template($output);
            } else {
                $data->rawhtml = ($item instanceof renderable) ? $output->render($item) : $item;
            }
            return $data;
        }, $this->secondaryactions);

        $data->primary = $primary;
        $data->secondary = $secondary;

        return $data;
    }
1040732
public function export_for_template(renderer_base $output) {
        $cnt = count($this->tags);
        return (object)array(
            'tags' => array_values($this->tags),
            'label' => $this->label,
            'tagscount' => $cnt,
            'overflow' => ($this->limit && $cnt > $this->limit) ? 1 : 0,
            'classes' => $this->classes,
        );
    }
756284
protected function get_other_values(renderer_base $output) {
        $capabilitymanager = $this->related['capabilitymanager'];
        $forum = $this->related['forum'];
        $user = $this->related['user'];
        $discussion = $this->summary->get_discussion();

        $related = (array) (object) $this->related;
        $related['latestpostid'] = $this->latestpostid;
        $related['groupsbyid'] = $this->groupsbyid;
        $discussionexporter = new discussion($discussion, $related);

        $related = [
            'urlfactory' => $this->related['urlfactory'],
            'context' => $this->related['forum']->get_context(),
        ];

        $firstpostauthor = new author(
            $this->summary->get_first_post_author(),
            $this->firstpostauthorcontextid,
            $this->groupsbyauthorid[$this->summary->get_first_post_author()->get_id()],
            $capabilitymanager->can_view_post(
                $user,
                $discussion,
                $this->summary->get_first_post()
            ),
            $related
        );

        $latestpostauthor = new author(
            $this->summary->get_latest_post_author(),
            $this->latestpostauthorcontextid,
            [],
            $capabilitymanager->can_view_post(
                $user,
                $discussion,
                $this->summary->get_first_post()
            ),
            $related
        );

        return [
            'id' => $discussion->get_id(),
            'discussion' => $discussionexporter->export($output),
            'replies' => $this->replycount,
            'unread' => $this->unreadcount,
            'firstpostauthor' => $firstpostauthor->export($output),
            'latestpostauthor' => $latestpostauthor->export($output),
            'latestpostid' => $this->latestpostid,
        ];
    }
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;
    }
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);
    }
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')
        ];
    }
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;
    }
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;
    }