本文整理汇总了PHP中renderer_base类的典型用法代码示例。如果您正苦于以下问题:PHP renderer_base类的具体用法?PHP renderer_base怎么用?PHP renderer_base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了renderer_base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export_for_template
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param \renderer_base $output
* @return \stdClass
*/
public function export_for_template(\renderer_base $output)
{
if ($this->value) {
$this->displayvalue = $output->pix_icon('i/checked', get_string('yes'));
} else {
$this->displayvalue = $output->pix_icon('i/unchecked', get_string('no'));
}
return parent::export_for_template($output);
}
示例2: export_for_template
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param \renderer_base $output
* @return \stdClass
*/
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);
}
示例3: export_for_template
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param \renderer_base $output
* @return \stdClass
*/
public function export_for_template(\renderer_base $output)
{
if ($this->value) {
$this->edithint = get_string('resetflag', 'core_tag');
$this->displayvalue = $output->pix_icon('i/flagged', $this->edithint) . " ({$this->value})";
} else {
$this->edithint = get_string('flagasinappropriate', 'core_tag');
$this->displayvalue = $output->pix_icon('i/unflagged', $this->edithint);
}
return parent::export_for_template($output);
}
示例4: export_for_template
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param \renderer_base $output
* @return \stdClass
*/
public function export_for_template(\renderer_base $output)
{
if ($this->value) {
$this->edithint = get_string('settypedefault', 'core_tag');
$this->displayvalue = $output->pix_icon('i/checked', $this->edithint);
} else {
$this->edithint = get_string('settypestandard', 'core_tag');
$this->displayvalue = $output->pix_icon('i/unchecked', $this->edithint);
}
return parent::export_for_template($output);
}
示例5: export_for_template
public function export_for_template(\renderer_base $output)
{
global $USER;
$context = clone $this->notification;
if ($context->useridto == $USER->id && $context->timeusertodeleted) {
$context->deleted = true;
} else {
$context->deleted = false;
}
$context->timecreatedpretty = get_string('ago', 'message', format_time(time() - $context->timecreated));
$context->text = message_format_message_text($context);
$context->read = $context->timeread ? true : false;
$context->shortenedsubject = shorten_text($context->subject, 125);
if (!empty($context->component) && substr($context->component, 0, 4) == 'mod_') {
$iconurl = $output->pix_url('icon', $context->component);
} else {
$iconurl = $output->pix_url('i/marker', 'core');
}
$context->iconurl = $iconurl->out();
return $context;
}
示例6: message_popup_render_navbar_output
/**
* Renders the popup.
*
* @param renderer_base $renderer
* @return string The HTML
*/
function message_popup_render_navbar_output(\renderer_base $renderer)
{
global $USER, $CFG;
// Early bail out conditions.
if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) || get_user_preferences('auth_forcepasswordchange') || $CFG->sitepolicy && !$USER->policyagreed && !is_siteadmin()) {
return '';
}
$output = '';
// Add the messages popover.
if (!empty($CFG->messaging)) {
$context = ['userid' => $USER->id, 'urls' => ['seeall' => (new moodle_url('/message/index.php'))->out(), 'writeamessage' => (new moodle_url('/message/index.php', ['contactsfirst' => 1]))->out(), 'preferences' => (new moodle_url('/message/edit.php', ['id' => $USER->id]))->out()]];
$output .= $renderer->render_from_template('message_popup/message_popover', $context);
}
// Add the notifications popover.
$enabled = \core_message\api::is_processor_enabled("popup");
if ($enabled) {
$context = ['userid' => $USER->id, 'urls' => ['seeall' => (new moodle_url('/message/output/popup/notifications.php'))->out(), 'preferences' => (new moodle_url('/message/notificationpreferences.php', ['userid' => $USER->id]))->out()]];
$output .= $renderer->render_from_template('message_popup/notification_popover', $context);
}
return $output;
}
示例7: message_popup_render_navbar_output
/**
* Renders the popup.
*
* @param renderer_base $renderer
* @return string The HTML
*/
function message_popup_render_navbar_output(\renderer_base $renderer)
{
global $USER, $DB, $CFG;
// Early bail out conditions.
if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) || get_user_preferences('auth_forcepasswordchange')) {
return '';
}
$output = '';
// Add the messages popover.
if (!empty($CFG->messaging)) {
$context = ['userid' => $USER->id, 'urls' => ['preferences' => (new moodle_url('/message/edit.php', ['id' => $USER->id]))->out()]];
$output .= $renderer->render_from_template('message_popup/message_popover', $context);
}
// Add the notifications popover.
$processor = $DB->get_record('message_processors', array('name' => 'popup'));
if ($processor && $processor->enabled) {
$context = ['userid' => $USER->id, 'urls' => ['preferences' => (new moodle_url('/message/notificationpreferences.php', ['userid' => $USER->id]))->out()]];
$output .= $renderer->render_from_template('message_popup/notification_popover', $context);
}
return $output;
}
示例8: theme_cleanhc_get_html_for_settings
/**
* Returns an object containing HTML for the areas affected by settings.
*
* Do not add Clean specific logic in here, child themes should be able to
* rely on that function just by declaring settings with similar names.
*
* @param renderer_base $output Pass in $OUTPUT.
* @param moodle_page $page Pass in $PAGE.
* @return stdClass An object with the following properties:
* - navbarclass A CSS class to use on the navbar. By default ''.
* - heading HTML to use for the heading. A logo if one is selected or the default heading.
* - footnote HTML to use as a footnote. By default ''.
*/
function theme_cleanhc_get_html_for_settings(renderer_base $output, moodle_page $page)
{
global $CFG;
$return = new stdClass();
$return->navbarclass = '';
if (!empty($page->theme->settings->invert)) {
$return->navbarclass .= ' navbar-inverse';
}
if (!empty($page->theme->settings->logo)) {
$return->heading = html_writer::tag('div', '', array('class' => 'logo'));
} else {
$return->heading = $output->page_heading();
}
$return->footnote = '';
if (!empty($page->theme->settings->footnote)) {
$return->footnote = '<div class="footnote text-center">' . format_text($page->theme->settings->footnote) . '</div>';
}
return $return;
}
示例9: export_for_template
/**
* Export context for use in mustache templates
*
* @see templatable::export_for_template()
* @param renderer_base $output
* @return array
*/
public function export_for_template(\renderer_base $output)
{
$data = array('id' => $this->id, 'permalink' => clean_param($this->permalink, PARAM_URL), 'datepublished' => $output->format_published_date($this->timestamp), 'link' => clean_param($this->link, PARAM_URL));
// If the item does not have a title, create one from the description.
$title = $this->title;
if (!$title) {
$title = strip_tags($this->description);
$title = \core_text::substr($title, 0, 20) . '...';
}
// Allow the renderer to format the title and description.
$data['title'] = $output->format_title($title);
$data['description'] = $this->showdescription ? $output->format_description($this->description) : null;
return $data;
}
示例10: get_element_properties
/**
* Returns an array of properties suitable for generating a quickforms element
* @param backup_task|null $task
* @return array (element, name, label, options, attributes)
*/
public function get_element_properties(base_task $task = null, renderer_base $output = null)
{
// name, label, text, attributes
$icon = $this->get_icon();
$label = $this->get_label($task);
if (!empty($icon)) {
$label .= $output->render($icon);
}
// name, label, options, attributes
return $this->apply_options(array('element' => 'select', 'name' => self::NAME_PREFIX . $this->name, 'label' => $label, 'options' => $this->values, 'attributes' => $this->attributes));
}
示例11: export_for_template
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param renderer_base $output Used to do a final render of any components that need to be rendered for export.
* @return array
*/
public function export_for_template(renderer_base $output)
{
$attributes = $this->attributes;
$attributes['src'] = $output->pix_url($this->pix, $this->component);
$templatecontext = array();
foreach ($attributes as $name => $value) {
$templatecontext[] = array('name' => $name, 'value' => $value);
}
$data = array('attributes' => $templatecontext);
return $data;
}
示例12: export_for_template
/**
* Export for template.
*
* @param renderer_base $output The renderer.
* @return stdClass
*/
public function export_for_template(renderer_base $output) {
$data = new stdClass();
$attributes = $this->attributes;
if (empty($attributes['id'])) {
$attributes['id'] = html_writer::random_id('action_link');
}
$data->id = $attributes['id'];
unset($attributes['id']);
$data->disabled = !empty($attributes['disabled']);
unset($attributes['disabled']);
$data->text = $this->text instanceof renderable ? $output->render($this->text) : (string) $this->text;
$data->url = $this->url ? $this->url->out(false) : '';
$data->icon = $this->icon ? $this->icon->export_for_template($output) : null;
$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);
$data->actions = array_map(function($action) use ($output) {
return $action->export_for_template($output);
}, !empty($this->actions) ? $this->actions : []);
$data->hasactions = !empty($this->actions);
return $data;
}
示例13: theme_ws_html_footer
/**
* Returns the html for the <footer> of the document.
*
* @param renderer_base $output Pass in $OUTPUT.
* @param moodle_page $page Pass in $PAGE.
* @return string The html.
*/
function theme_ws_html_footer(renderer_base $output, moodle_page $page)
{
global $CFG;
return '
<footer id="page-footer">
<div id="course-footer">' . $output->course_footer() . '</div>
<p class="helplink">' . $output->page_doc_link() . '</p>
' . $output->login_info() . '
' . $output->home_link() . '
' . $output->standard_footer_html() . '
</footer>
';
}
示例14: theme_clean_get_html_for_settings
/**
* Returns an object containing HTML for the areas affected by settings.
*
* Do not add Clean specific logic in here, child themes should be able to
* rely on that function just by declaring settings with similar names.
*
* @param renderer_base $output Pass in $OUTPUT.
* @param moodle_page $page Pass in $PAGE.
* @return stdClass An object with the following properties:
* - navbarclass A CSS class to use on the navbar. By default ''.
* - heading HTML to use for the heading. A logo if one is selected or the default heading.
* - footnote HTML to use as a footnote. By default ''.
*/
function theme_clean_get_html_for_settings(renderer_base $output, moodle_page $page) {
global $CFG,$USER;
$return = new stdClass;
$return->navbarclass = '';
if (!empty($page->theme->settings->invert)) {
$return->navbarclass .= ' navbar-inverse';
}
if(isloggedin()){
$display_blocks = html_writer::empty_tag('img', array('src' => $CFG->wwwroot.'/theme/clean/pix/block_slider.jpg', 'class' => 'display_blocks'));
}else{
$display_blocks = '';
}
if (!empty($page->theme->settings->logo)) {
$return->heading = $display_blocks.html_writer::link($CFG->wwwroot, '', array('title' => get_string('home'), 'class' => 'logo'));
} else {
$return->heading = $display_blocks.$output->page_heading();
}
$return->footnote = '';
if (!empty($page->theme->settings->footnote)) {
$return->footnote = '<div class="footnote text-center">'.format_text($page->theme->settings->footnote).'</div>';
}
//added code for disclaimer and browser support by rajesh
$return->browsersupport = '';
if (!empty($page->theme->settings->browsersupport)) {
$return->browsersupport = '<div>'.format_text($page->theme->settings->browsersupport).'</div>';
} else {
$return->browsersupport = '';
}
$return->disclaimer = '';
if (!empty($page->theme->settings->disclaimer)) {
$return->disclaimer = '<div>'.format_text($page->theme->settings->disclaimer).'</div>';
} else {
$return->disclaimer = '';
}
/*code change ends here*/
return $return;
}
示例15: get_config_for_javascript
/**
* Return the safe config values that get set for javascript in "M.cfg".
*
* @since 2.9
* @return array List of safe config values that are available to javascript.
*/
public function get_config_for_javascript(moodle_page $page, renderer_base $renderer)
{
global $CFG;
if (empty($this->M_cfg)) {
// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
// on secure pages from their web browser.
$this->M_cfg = array('wwwroot' => $CFG->httpswwwroot, 'sesskey' => sesskey(), 'loadingicon' => $renderer->pix_url('i/loading_small', 'moodle')->out(false), 'themerev' => theme_get_revision(), 'slasharguments' => (int) (!empty($CFG->slasharguments)), 'theme' => $page->theme->name, 'jsrev' => $this->get_jsrev(), 'admin' => $CFG->admin, 'svgicons' => $page->theme->use_svg_icons());
if ($CFG->debugdeveloper) {
$this->M_cfg['developerdebug'] = true;
}
if (defined('BEHAT_SITE_RUNNING')) {
$this->M_cfg['behatsiterunning'] = true;
}
}
return $this->M_cfg;
}