本文整理汇总了PHP中core_renderer类的典型用法代码示例。如果您正苦于以下问题:PHP core_renderer类的具体用法?PHP core_renderer怎么用?PHP core_renderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了core_renderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: data_to_string
/**
* Convert data attribute to a string
*
* @param \core_renderer $output
* @return string
*/
protected function data_to_string(\core_renderer $output)
{
if ($this->data instanceof \Exception) {
$info = get_exception_info($this->data);
return $output->fatal_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo);
} else {
return json_encode($this->data);
}
}
示例2: init_requirements_data
/**
* Initialise with the bits of JavaScript that every Moodle page should have.
*
* @param moodle_page $page
* @param core_renderer $output
*/
protected function init_requirements_data(moodle_page $page, core_renderer $renderer)
{
global $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(), 'theme' => $page->theme->name, 'jsrev' => (empty($CFG->cachejs) or empty($CFG->jsrev)) ? -1 : $CFG->jsrev);
if (debugging('', DEBUG_DEVELOPER)) {
$this->M_cfg['developerdebug'] = true;
$this->yui2_lib('logger');
}
// accessibility stuff
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
// to be removed soon
$this->yui2_lib('dom');
// at least javascript-static.js needs to be migrated to YUI3
$this->string_for_js('confirmation', 'admin');
$this->string_for_js('cancel', 'moodle');
$this->string_for_js('yes', 'moodle');
if ($page->pagelayout === 'frametop') {
$this->js_init_call('M.util.init_frametop');
}
}
示例3: init_requirements_data
/**
* Initialise with the bits of JavaScript that every Moodle page should have.
*
* @param moodle_page $page
* @param core_renderer $renderer
*/
protected function init_requirements_data(moodle_page $page, core_renderer $renderer)
{
global $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' => (empty($CFG->cachejs) or empty($CFG->jsrev)) ? -1 : $CFG->jsrev);
if (debugging('', DEBUG_DEVELOPER)) {
$this->M_cfg['developerdebug'] = true;
}
// Accessibility stuff.
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
// Add strings used on many pages.
$this->string_for_js('confirmation', 'admin');
$this->string_for_js('cancel', 'moodle');
$this->string_for_js('yes', 'moodle');
// Alter links in top frame to break out of frames.
if ($page->pagelayout === 'frametop') {
$this->js_init_call('M.util.init_frametop');
}
}
示例4: user_menu
public function user_menu($user = null, $withlinks = null)
{
$output = '';
$messageurl = new moodle_url('/message/index.php');
$output .= '<a href="#" class="nav-icon nav-icon"><i class="fa fa-globe"></i></a>';
$output .= '<a href="' . $messageurl->out() . '" class="nav-icon nav-icon"><i class="fa fa-envelope"></i></a>';
$output .= core_renderer::user_menu($user, $withlinks);
return $output;
}
示例5: init_requirements_data
/**
* Initialise with the bits of JavaScript that every Moodle page should have.
*
* @param moodle_page $page
* @param core_renderer $renderer
*/
protected function init_requirements_data(moodle_page $page, core_renderer $renderer)
{
global $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' => (empty($CFG->cachejs) or empty($CFG->jsrev)) ? -1 : $CFG->jsrev, 'svgicons' => $page->theme->use_svg_icons());
if (debugging('', DEBUG_DEVELOPER)) {
$this->M_cfg['developerdebug'] = true;
}
if (defined('BEHAT_SITE_RUNNING')) {
$this->M_cfg['behatsiterunning'] = true;
}
// Accessibility stuff.
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
// Add strings used on many pages.
$this->string_for_js('confirmation', 'admin');
$this->string_for_js('cancel', 'moodle');
$this->string_for_js('yes', 'moodle');
// Alter links in top frame to break out of frames.
if ($page->pagelayout === 'frametop') {
$this->js_init_call('M.util.init_frametop');
}
// Include block drag/drop if editing is on
if ($page->user_is_editing()) {
$params = array('courseid' => $page->course->id, 'pagetype' => $page->pagetype, 'pagelayout' => $page->pagelayout, 'subpage' => $page->subpage, 'regions' => $page->blocks->get_regions(), 'contextid' => $page->context->id);
if (!empty($page->cm->id)) {
$params['cmid'] = $page->cm->id;
}
$page->requires->yui_module('moodle-core-blocks', 'M.core_blocks.init_dragdrop', array($params), null, true);
}
}
示例6: formatted_contents
/**
* Make the formatted HTML ouput.
*
* Also adds the required javascript call to the page output.
*
* @param core_renderer $output
* @return string HTML
*/
protected function formatted_contents($output)
{
// based of code in admin_tree
global $PAGE;
// TODO change this when there is a proper way for blocks to get stuff into head.
static $eventattached;
if ($eventattached === null) {
$eventattached = true;
}
if (!$this->content) {
$this->content = new stdClass();
$this->content->items = array();
}
$this->get_required_javascript();
$this->get_content();
$content = $output->tree_block_contents($this->content->items, array('class' => 'block_tree list'));
if (isset($this->id) && !is_numeric($this->id)) {
$content = $output->box($content, 'block_tree_box', $this->id);
}
return $content;
}
示例7: get_direction_icon
/**
* Gets the direction icon for the sortable field within this table
*
* @param core_renderer $output
* @param string $field
* @return string
*/
protected function get_direction_icon($output, $field)
{
$direction = self::DEFAULTSORTDIRECTION;
if ($this->sort == $field) {
$direction = $this->sortdirection;
}
if ($direction === 'ASC') {
return html_writer::empty_tag('img', array('alt' => '', 'src' => $output->pix_url('t/down')));
} else {
return html_writer::empty_tag('img', array('alt' => '', 'src' => $output->pix_url('t/up')));
}
}
示例8: mysqli_native_moodle_database
/**
* Sharing Cart - Bulk Delete Operation
*
* @author VERSION2, Inc.
* @version $Id: bulkdelete.php 942 2013-03-28 10:42:54Z malu $
*/
require_once '../../config.php';
require_once __DIR__ . '/classes/storage.php';
require_once __DIR__ . '/classes/record.php';
require_once __DIR__ . '/classes/renderer.php';
if (false) {
$DB = new mysqli_native_moodle_database();
$CFG = new stdClass();
$USER = new stdClass();
$PAGE = new moodle_page();
$OUTPUT = new core_renderer();
}
$courseid = required_param('course', PARAM_INT);
$returnurl = new moodle_url('/course/view.php', array('id' => $courseid));
require_login($courseid);
$delete_param = function_exists('optional_param_array') ? optional_param_array('delete', null, PARAM_RAW) : optional_param('delete', null, PARAM_RAW);
if (is_array($delete_param)) {
try {
set_time_limit(0);
$delete_ids = array_map('intval', array_keys($delete_param));
list($sql, $params) = $DB->get_in_or_equal($delete_ids);
$records = $DB->get_records_select(sharing_cart\record::TABLE, "userid = {$USER->id} AND id {$sql}", $params);
if (!$records) {
throw new sharing_cart\exception('recordnotfound');
}
$storage = new sharing_cart\storage();
示例9: standard_head_html
/**
* The standard tags that should be included in the <head> tag
* including a meta description for the front page
*
* @return string HTML fragment.
*/
public function standard_head_html()
{
global $SITE, $PAGE;
$output = parent::standard_head_html();
if ($PAGE->pagelayout == 'frontpage') {
$summary = s(strip_tags(format_text($SITE->summary, FORMAT_HTML)));
if (!empty($summary)) {
$output .= "<meta name=\"description\" content=\"{$summary}\" />\n";
}
}
return $output;
}
示例10: render_custom_menu_item
/**
* Renders a custom menu node as part of a submenu
*
* The custom menu this method override the render_custom_menu_item function
* in outputrenderers.php
*
* @see render_custom_menu()
*
* @staticvar int $submenucount
* @param custom_menu_item $menunode
* @return string
*/
protected function render_custom_menu_item(custom_menu_item $menunode)
{
if (!right_to_left()) {
// Keep YUI3 navmenu for LTR UI
parent::render_custom_menu_item($menunode);
}
// Required to ensure we get unique trackable id's
static $submenucount = 0;
$content = html_writer::start_tag('li');
if ($menunode->has_children()) {
// If the child has menus render it as a sub menu
$submenucount++;
if ($menunode->get_url() !== null) {
$url = $menunode->get_url();
} else {
$url = '#cm_submenu_' . $submenucount;
}
$content .= html_writer::start_tag('span', array('class' => 'customitem'));
$content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
$content .= html_writer::end_tag('span');
$content .= html_writer::start_tag('ul');
foreach ($menunode->get_children() as $menunode) {
$content .= $this->render_custom_menu_item($menunode);
}
$content .= html_writer::end_tag('ul');
} else {
// The node doesn't have children so produce a final menuitem
if ($menunode->get_url() !== null) {
$url = $menunode->get_url();
} else {
$url = '#';
}
$content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
}
$content .= html_writer::end_tag('li');
// Return the sub menu
return $content;
}
示例11: __construct
/**
* Initialises the renderer instance.
* @param moodle_page $page
* @param string $target
* @throws coding_exception
*/
public function __construct(moodle_page $page, $target) {
if ($target !== RENDERER_TARGET_MAINTENANCE || $page->pagelayout !== 'maintenance') {
throw new coding_exception('Invalid request for the maintenance renderer.');
}
parent::__construct($page, $target);
}
示例12: render_pix_icon
protected function render_pix_icon(pix_icon $icon)
{
if (self::replace_moodle_icon($icon->pix) !== false && @$icon->attributes['alt'] === '' && @$icon->attributes['title'] === '') {
return self::replace_moodle_icon($icon->pix);
} else {
return parent::render_pix_icon($icon);
}
}
示例13: render_navigation_node
/**
* Renders a navigation node
*
* This function has been overridden to remove tabindexs
*
* @param navigation_node $item
* @return string
*/
protected function render_navigation_node(navigation_node $item) {
// Generate the content normally
$content = parent::render_navigation_node($item);
// Strip out any tabindex's
$content = str_replace(' tabindex="0"', '', $content);
$content = str_replace(' tabindex=\'0\'', '', $content);
// Return the cleaned content
return $content;
}
示例14: box
public function box($contents, $classes = 'generalbox', $id = null, $attributes = array()) {
if (isset($attributes['data-rel']) && $attributes['data-rel'] === 'fatalerror') {
return html_writer::div($contents, 'alert alert-danger', $attributes);
}
return parent::box($contents, $classes, $id, $attributes);
}
示例15: favicon
/**
* Returns the URL for the favicon.
*
* @return string The favicon URL
*/
public function favicon() {
if (!empty($this->page->theme->settings->favicon)) {
return $this->page->theme->setting_file_url('favicon', 'favicon');
}
return parent::favicon();
}