本文整理汇总了PHP中renderer_base::render_from_template方法的典型用法代码示例。如果您正苦于以下问题:PHP renderer_base::render_from_template方法的具体用法?PHP renderer_base::render_from_template怎么用?PHP renderer_base::render_from_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类renderer_base
的用法示例。
在下文中一共展示了renderer_base::render_from_template方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: render
/**
* Renders this element
*
* @param renderer_base $output typically, the renderer that's calling this function
* @return string
*/
public function render(\renderer_base $output)
{
return $output->render_from_template('core/inplace_editable', $this->export_for_template($output));
}