本文整理汇总了PHP中moodle_page::set_heading方法的典型用法代码示例。如果您正苦于以下问题:PHP moodle_page::set_heading方法的具体用法?PHP moodle_page::set_heading怎么用?PHP moodle_page::set_heading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodle_page
的用法示例。
在下文中一共展示了moodle_page::set_heading方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: if
} else if ($choose && $device && !$unsettheme && confirm_sesskey()) {
// Load the theme to make sure it is valid.
$theme = theme_config::load($choose);
// Get the config argument for the chosen device.
$themename = get_device_cfg_var_name($device);
set_config($themename, $theme->name);
// Create a new page for the display of the themes readme.
// This ensures that the readme page is shown using the new theme.
$confirmpage = new moodle_page();
$confirmpage->set_context($PAGE->context);
$confirmpage->set_url($PAGE->url);
$confirmpage->set_pagelayout($PAGE->pagelayout);
$confirmpage->set_pagetype($PAGE->pagetype);
$confirmpage->set_title($PAGE->title);
$confirmpage->set_heading($PAGE->heading);
// Get the core renderer for the new theme.
$output = $confirmpage->get_renderer('core');
echo $output->header();
echo $output->heading(get_string('themesaved'));
echo $output->box_start();
echo format_text(get_string('choosereadme', 'theme_'.$theme->name), FORMAT_MOODLE);
echo $output->box_end();
echo $output->continue_button($CFG->wwwroot . '/theme/index.php');
echo $output->footer();
exit;
} else if ($device && $unsettheme && confirm_sesskey() && ($device != 'default')) {
//Unset the theme and continue.
unset_config(get_device_cfg_var_name($device));
示例2: process_url_edit
//.........这里部分代码省略.........
$bi->showinsubcontexts = true;
$bi->pagetypepattern = '*';
break;
case BUI_CONTEXTS_FRONTPAGE_ONLY:
// The user want to show the front page on the frontpage only
$bi->parentcontextid = $frontpagecontext->id;
$bi->showinsubcontexts = false;
$bi->pagetypepattern = 'site-index';
// This is the only relevant page type anyway but we'll set it explicitly just
// in case the front page grows site-index-* subpages of its own later
break;
}
}
}
$bits = explode('-', $bi->pagetypepattern);
// hacks for some contexts
if ($parentcontext->contextlevel == CONTEXT_COURSE && $parentcontext->instanceid != SITEID) {
// For course context
// is page type pattern is mod-*, change showinsubcontext to 1
if ($bits[0] == 'mod' || $bi->pagetypepattern == '*') {
$bi->showinsubcontexts = 1;
} else {
$bi->showinsubcontexts = 0;
}
} else {
if ($parentcontext->contextlevel == CONTEXT_USER) {
// for user context
// subpagepattern should be null
if ($bits[0] == 'user' or $bits[0] == 'my') {
// we don't need subpagepattern in usercontext
$bi->subpagepattern = null;
}
}
}
$bi->defaultregion = $data->bui_defaultregion;
$bi->defaultweight = $data->bui_defaultweight;
$DB->update_record('block_instances', $bi);
if (!empty($block->config)) {
$config = clone $block->config;
} else {
$config = new stdClass();
}
foreach ($data as $configfield => $value) {
if (strpos($configfield, 'config_') !== 0) {
continue;
}
$field = substr($configfield, 7);
$config->{$field} = $value;
}
$block->instance_config_save($config);
$bp = new stdClass();
$bp->visible = $data->bui_visible;
$bp->region = $data->bui_region;
$bp->weight = $data->bui_weight;
$needbprecord = !$data->bui_visible || $data->bui_region != $data->bui_defaultregion || $data->bui_weight != $data->bui_defaultweight;
if ($block->instance->blockpositionid && !$needbprecord) {
$DB->delete_records('block_positions', array('id' => $block->instance->blockpositionid));
} else {
if ($block->instance->blockpositionid && $needbprecord) {
$bp->id = $block->instance->blockpositionid;
$DB->update_record('block_positions', $bp);
} else {
if ($needbprecord) {
$bp->blockinstanceid = $block->instance->id;
$bp->contextid = $this->page->context->id;
$bp->pagetype = $this->page->pagetype;
if ($this->page->subpage) {
$bp->subpage = $this->page->subpage;
} else {
$bp->subpage = '';
}
$DB->insert_record('block_positions', $bp);
}
}
}
redirect($this->page->url);
} else {
$strheading = get_string('blockconfiga', 'moodle', $block->get_title());
$editpage->set_title($strheading);
$editpage->set_heading($strheading);
$bits = explode('-', $this->page->pagetype);
if ($bits[0] == 'tag' && !empty($this->page->subpage)) {
// better navbar for tag pages
$editpage->navbar->add(get_string('tags'), new moodle_url('/tag/'));
$tag = tag_get('id', $this->page->subpage, '*');
// tag search page doesn't have subpageid
if ($tag) {
$editpage->navbar->add($tag->name, new moodle_url('/tag/index.php', array('id' => $tag->id)));
}
}
$editpage->navbar->add($block->get_title());
$editpage->navbar->add(get_string('configuration'));
echo $output->header();
echo $output->heading($strheading, 2);
$mform->display();
echo $output->footer();
exit;
}
}
}
示例3: process_url_edit
//.........这里部分代码省略.........
if (!class_exists($classname)) {
$classname = 'block_edit_form';
}
} else {
$classname = 'block_edit_form';
}
$mform = new $classname($editpage->url, $block, $this->page);
$mform->set_data($block->instance);
if ($mform->is_cancelled()) {
redirect($this->page->url);
} else {
if ($data = $mform->get_data()) {
$bi = new stdClass();
$bi->id = $block->instance->id;
$bi->pagetypepattern = $data->bui_pagetypepattern;
if (empty($data->bui_subpagepattern) || $data->bui_subpagepattern == '%@NULL@%') {
$bi->subpagepattern = null;
} else {
$bi->subpagepattern = $data->bui_subpagepattern;
}
$parentcontext = get_context_instance_by_id($data->bui_parentcontextid);
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
// Updating stickiness and contexts. See MDL-21375 for details.
if (has_capability('moodle/site:manageblocks', $parentcontext)) {
// Check permissions in destination
// Explicitly set the context
$bi->parentcontextid = $parentcontext->id;
// If the context type is > 0 then we'll explicitly set the block as sticky, otherwise not
$bi->showinsubcontexts = (int) (!empty($data->bui_contexts));
// If the block wants to be system-wide, then explicitly set that
if ($data->bui_contexts == 2) {
// Only possible on a frontpage or system page
$bi->parentcontextid = $systemcontext->id;
} else {
// The block doesn't want to be system-wide, so let's ensure that
if ($parentcontext->id == $systemcontext->id) {
// We need to move it to the front page
$frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
$bi->parentcontextid = $frontpagecontext->id;
$bi->pagetypepattern = '*';
// Just in case
}
}
}
$bi->defaultregion = $data->bui_defaultregion;
$bi->defaultweight = $data->bui_defaultweight;
$DB->update_record('block_instances', $bi);
if (!empty($block->config)) {
$config = clone $block->config;
} else {
$config = new stdClass();
}
foreach ($data as $configfield => $value) {
if (strpos($configfield, 'config_') !== 0) {
continue;
}
$field = substr($configfield, 7);
$config->{$field} = $value;
}
$block->instance_config_save($config);
$bp = new stdClass();
$bp->visible = $data->bui_visible;
$bp->region = $data->bui_region;
$bp->weight = $data->bui_weight;
$needbprecord = !$data->bui_visible || $data->bui_region != $data->bui_defaultregion || $data->bui_weight != $data->bui_defaultweight;
if ($block->instance->blockpositionid && !$needbprecord) {
$DB->delete_records('block_positions', array('id' => $block->instance->blockpositionid));
} else {
if ($block->instance->blockpositionid && $needbprecord) {
$bp->id = $block->instance->blockpositionid;
$DB->update_record('block_positions', $bp);
} else {
if ($needbprecord) {
$bp->blockinstanceid = $block->instance->id;
$bp->contextid = $this->page->context->id;
$bp->pagetype = $this->page->pagetype;
if ($this->page->subpage) {
$bp->subpage = $this->page->subpage;
} else {
$bp->subpage = '';
}
$DB->insert_record('block_positions', $bp);
}
}
}
redirect($this->page->url);
} else {
$strheading = get_string('blockconfiga', 'moodle', $block->get_title());
$editpage->set_title($strheading);
$editpage->set_heading($strheading);
$editpage->navbar->add($strheading);
$output = $editpage->get_renderer('core');
echo $output->header();
echo $output->heading($strheading, 2);
$mform->display();
echo $output->footer();
exit;
}
}
}
示例4: process_url_edit
//.........这里部分代码省略.........
return false;
}
confirm_sesskey();
require_once $CFG->dirroot . '/blocks/edit_form.php';
$block = $this->find_instance($blockid);
if (!$block->user_can_edit() && !$this->page->user_can_edit_blocks()) {
throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('editblock'));
}
$editpage = new moodle_page();
$editpage->set_generaltype('form');
$editpage->set_course($this->page->course);
$editpage->set_context($block->context);
$editurlbase = str_replace($CFG->wwwroot . '/', '', $this->page->url->out(true));
$editurlparams = $this->page->url->params();
$editurlparams['bui_editid'] = $blockid;
$editpage->set_url($editurlbase, $editurlparams);
$editpage->_block_actions_done = true;
// At this point we are either going to redirect, or display the form, so
// overwrite global $PAGE ready for this. (Formslib refers to it.)
$PAGE = $editpage;
$formfile = $CFG->dirroot . '/blocks/' . $block->name() . '/edit_form.php';
if (is_readable($formfile)) {
require_once $formfile;
$classname = 'block_' . $block->name() . '_edit_form';
} else {
$classname = 'block_edit_form';
}
$mform = new $classname($editpage->url, $block, $this->page);
$mform->set_data($block->instance);
if ($mform->is_cancelled()) {
redirect($this->page->url);
} else {
if ($data = $mform->get_data()) {
$bi = new stdClass();
$bi->id = $block->instance->id;
$bi->showinsubcontexts = $data->bui_showinsubcontexts;
$bi->pagetypepattern = $data->bui_pagetypepattern;
if (empty($data->bui_subpagepattern) || $data->bui_subpagepattern == '%@NULL@%') {
$bi->subpagepattern = null;
} else {
$bi->subpagepattern = $data->bui_subpagepattern;
}
$bi->defaultregion = $data->bui_defaultregion;
$bi->defaultweight = $data->bui_defaultweight;
$DB->update_record('block_instances', $bi);
if (!empty($block->config)) {
$config = clone $block->config;
} else {
$config = new stdClass();
}
foreach ($data as $configfield => $value) {
if (strpos($configfield, 'config_') !== 0) {
continue;
}
$field = substr($configfield, 7);
$config->{$field} = $value;
}
$block->instance_config_save($config);
$bp = new stdClass();
$bp->visible = $data->bui_visible;
$bp->region = $data->bui_region;
$bp->weight = $data->bui_weight;
$needbprecord = !$data->bui_visible || $data->bui_region != $data->bui_defaultregion || $data->bui_weight != $data->bui_defaultweight;
if ($block->instance->blockpositionid && !$needbprecord) {
$DB->delete_records('block_positions', array('id' => $block->instance->blockpositionid));
} else {
if ($block->instance->blockpositionid && $needbprecord) {
$bp->id = $block->instance->blockpositionid;
$DB->update_record('block_positions', $bp);
} else {
if ($needbprecord) {
$bp->blockinstanceid = $block->instance->id;
$bp->contextid = $this->page->context->id;
$bp->pagetype = $this->page->pagetype;
if ($this->page->subpage) {
$bp->subpage = $this->page->subpage;
} else {
$bp->subpage = '';
}
$DB->insert_record('block_positions', $bp);
}
}
}
redirect($this->page->url);
} else {
$strheading = get_string('editinga', $block->name());
if (strpos($strheading, '[[') === 0) {
$strheading = get_string('blockconfiga', 'moodle', $block->get_title());
}
$editpage->set_title($strheading);
$editpage->set_heading($strheading);
$output = $editpage->theme->get_renderer('core', $editpage);
echo $output->header();
echo $output->heading($strheading, 2);
$mform->display();
echo $output->footer();
exit;
}
}
}
示例5: VARCHAR
} else {
print_error('unexpectederror', 'block_sharing_cart', $returnurl);
}
}
}
$orderby = 'tree,weight,modtext';
if ($DB->get_dbfamily() == 'mssql' || $DB->get_dbfamily() == 'oracle') {
// SQL Server and Oracle do not support ordering by TEXT field.
$orderby = 'tree,weight,CAST(modtext AS VARCHAR(255))';
}
$items = $DB->get_records(sharing_cart\record::TABLE, array('userid' => $USER->id), $orderby);
$title = get_string('bulkdelete', 'block_sharing_cart');
$PAGE->set_pagelayout('standard');
$PAGE->set_url('/blocks/sharing_cart/bulkdelete.php', array('course' => $courseid));
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->navbar->add(get_string('pluginname', 'block_sharing_cart'))->add($title, '');
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
echo '
<div style="width:100%; text-align:center;">';
if (empty($items)) {
echo '
<div>
<input type="button" onclick="history.back();" value="', get_string('back'), '" />
</div>';
} else {
echo '
<script type="text/javascript">
//<![CDATA[
function get_checks()