本文整理汇总了PHP中blocks_have_content函数的典型用法代码示例。如果您正苦于以下问题:PHP blocks_have_content函数的具体用法?PHP blocks_have_content怎么用?PHP blocks_have_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了blocks_have_content函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
global $PAGE, $COURSE;
$editing = $PAGE->user_is_editing();
$pageblocks = page_blocks_setup();
/// Make sure we can see this page
if (!($this->page->display & DISP_PUBLISH) and !(has_capability('format/page:editpages', $this->context) and $editing)) {
error(get_string('thispageisnotpublished', 'format_page'));
}
/// Finally, we can print the page
if ($editing) {
$PAGE->print_tabs('layout');
page_print_jump_menu();
page_print_add_mods_form($this->page, $COURSE);
$class = 'format-page editing';
} else {
$class = 'format-page';
}
echo '<table id="layout-table" class="' . $class . '" cellspacing="0" summary="' . get_string('layouttable') . '">';
/// Check if the page is locked, if so, print lock message, otherwise print three columns
if (page_is_locked($this->page)) {
echo '<tr><td colspan="3">';
page_print_lock_prerequisites($this->page);
echo '</tr></td>';
} else {
echo '<tr>';
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT)) {
page_print_position($pageblocks, BLOCK_POS_LEFT, $this->page->prefleftwidth);
}
page_print_position($pageblocks, BLOCK_POS_CENTER, '100%');
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
page_print_position($pageblocks, BLOCK_POS_RIGHT, $this->page->prefrightwidth);
}
echo '</tr>';
}
/// Silently attempts to call a function from the block_recent_history block
@block_method_result('recent_history', 'block_recent_history_record', $this->page);
/// Display navigation buttons
if ($this->page->showbuttons) {
$nav = page_get_next_previous_pages($this->page->id, $this->page->courseid);
$buttons = '';
if ($nav->prev and $this->page->showbuttons & BUTTON_PREV) {
$title = get_string('previous', 'format_page', page_get_name($nav->prev));
$buttons .= '<span class="prevpage"><a href="' . $PAGE->url_build('page', $nav->prev->id) . "\" title=\"{$title}\">{$title}</a></span>";
}
if ($nav->next and $this->page->showbuttons & BUTTON_NEXT) {
$title = get_string('next', 'format_page', page_get_name($nav->next));
$buttons .= '<span class="nextpage"><a href="' . $PAGE->url_build('page', $nav->next->id) . "\" title=\"{$title}\">{$title}</a></span>";
}
// Make sure we have something to print
if (!empty($buttons)) {
echo "\n<tr><td></td><td>{$buttons}</td><td></td></tr>\n";
}
}
echo '</table>';
}
示例2: display_course_blocks_end
/**
* Finish displaying the resource with the course blocks
*/
function display_course_blocks_end()
{
global $CFG;
global $THEME;
$PAGE = $this->PAGE;
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
if ($column != 'middle') {
array_shift($lt);
} else {
if ($column == 'middle') {
break;
}
}
}
foreach ($lt as $column) {
switch ($column) {
case 'left':
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="left-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print_container_end();
echo '</td>';
}
break;
case 'middle':
echo '</div>';
print_container_end();
echo '</td>';
break;
case 'right':
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="right-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo '</td>';
}
break;
}
}
echo '</tr></table>';
print_footer($this->course);
}
示例3: bounded_number
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
/// Print the page header
$strenterchat = get_string('enterchat', 'chat');
$stridle = get_string('idle', 'chat');
$strcurrentusers = get_string('currentusers', 'chat');
$strnextsession = get_string('nextsession', 'chat');
if ($edit != -1 and $PAGE->user_allowed_editing()) {
$USER->editing = $edit;
}
$PAGE->print_header($course->shortname . ': %fullname%');
echo '<table id="layout-table"><tr>';
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
switch ($column) {
case 'left':
if (!empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="left-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print_container_end();
echo '</td>';
}
break;
case 'middle':
echo '<td id="middle-column">';
print_container_start();
/// Check to see if groups are being used here
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, "view.php?id={$cm->id}");
if ($currentgroup) {
示例4: page_print_position
/**
* Prints blocks for a given position
*
* @param array $pageblocks An array of blocks organized by position
* @param char $position Position that we are currently printing
* @return void
**/
function page_print_position($pageblocks, $position, $width)
{
global $PAGE, $THEME;
$editing = $PAGE->user_is_editing();
/// Figure out an appropriate ID
switch ($position) {
case BLOCK_POS_LEFT:
$id = 'left';
break;
case BLOCK_POS_RIGHT:
$id = 'right';
break;
case BLOCK_POS_CENTER:
$id = 'middle';
break;
default:
$id = $position;
break;
}
/// Figure out the width - more for routine than being functional. May want to impose a minimum width though
$width = bounded_number($width, blocks_preferred_width($pageblocks[$position]), $width);
$widthstyle = "";
if ($width > 1) {
$widthstyle = 'style="width: ' . $width . 'px"';
}
if ($editing || blocks_have_content($pageblocks, $position)) {
/// Print it
echo "<td {$widthstyle} id=\"{$id}-column\">";
print_spacer(1, $width, false);
if (!empty($THEME->roundcorners)) {
echo '<div class="bt"><div></div></div>';
echo '<div class="i1"><div class="i2"><div class="i3">';
}
page_blocks_print_group($pageblocks, $position);
if (!empty($THEME->roundcorners)) {
echo '</div></div></div>';
echo '<div class="bb"><div></div></div>';
}
echo '</td>';
} else {
// just print space to keep width consistent
echo "<td {$widthstyle} id=\"{$id}-column\">";
print_spacer(1, $width, false);
echo "</td>";
}
}
示例5: update_module_button
<input type="text" name="query" value=""/>
<input type="hidden" name="id" value="{$cm->id}"/>
<input type="submit" value="{$strblogsearch}"/>
</div></form>
EOF;
} else {
$buttontext = '';
}
$buttontext .= update_module_button($cm->id, $course->id, $stroublog);
$PAGEWILLCALLSKIPMAINDESTINATION = true;
// OU accessibility feature
$navigation = build_navigation($navlinks);
print_header_simple(format_string($oublog->name), "", $navigation, "", oublog_get_meta_tags($oublog, 'all', '', $cm), true, $buttontext, navmenu($course, $cm));
print '<div class="oublog-topofpage"></div>';
// The left column ...
if ($hasleft = !empty($CFG->showblocksonmodpages) && blocks_have_content($pageblocks, BLOCK_POS_LEFT)) {
print '<div id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print '</div>';
}
// The right column, BEFORE the middle-column.
print '<div id="right-column">';
if (isloggedin() and !isguestuser()) {
list($oublog, $oubloginstance) = oublog_get_personal_blog($USER->id);
$blogeditlink = "<br /><a href=\"view.php\" class=\"oublog-links\">{$oubloginstance->name}</a>";
print_side_block(format_string($oublog->name), $blogeditlink, NULL, NULL, NULL, array('id' => 'oublog-summary'), get_string('bloginfo', 'oublog'));
}
if ($feeds = oublog_get_feedblock($oublog, 'all', '', false, $cm)) {
print_side_block($strfeeds, $feeds, NULL, NULL, NULL, array('id' => 'oublog-feeds'), $strfeeds);
}
print '</div>';
示例6:
break;
case FRONTPAGETOPICONLY:
// Do nothing!! :-)
break;
}
echo '<br />';
}
if (!empty($THEME->roundcorners)) {
echo '</div></div></div>';
echo '<div class="bb"><div></div></div>';
}
echo '</td>';
break;
case 'right':
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing || has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, SITEID))) {
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
if (!empty($THEME->roundcorners)) {
echo '<div class="bt"><div></div></div>';
echo '<div class="i1"><div class="i2"><div class="i3">';
}
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, SITEID))) {
echo '<div style="text-align:center">' . update_course_icon($SITE->id) . '</div>';
echo '<br />';
}
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
if (!empty($THEME->roundcorners)) {
echo '</div></div></div>';
echo '<div class="bb"><div></div></div>';
}
echo '</td>';
示例7: rand
echo '<a href="view.php?id=' . $course->id . '&random=' . rand(1, 10000) . '&section=' . $section . '&move=1&sesskey=' . $USER->sesskey . '#section-' . ($section + 1) . '" title="' . $strmovedown . '">' . '<img src="' . $CFG->pixpath . '/t/down.gif" class="iconsmall down" alt="' . $strmovedown . '" /></a><br />';
}
}
echo '</td></tr>';
echo '<tr class="section separator"><td colspan="3" class="spacer"></td></tr>';
}
$section++;
$weekdate = $nextweekdate;
}
echo '</table>';
if (!empty($sectionmenu)) {
echo '<div class="jumpmenu">';
echo popup_form($CFG->wwwroot . '/course/view.php?id=' . $course->id . '&', $sectionmenu, 'sectionmenu', '', get_string('jumpto'), '', '', true);
echo '</div>';
}
print_container_end();
echo '</td>';
break;
case 'right':
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo '</td>';
}
break;
}
}
echo '</tr></table>';
示例8: display_course_blocks_end
/**
* Finish displaying the resource with the course blocks
*/
function display_course_blocks_end()
{
global $CFG;
$PAGE = $this->PAGE;
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
echo '</div>';
if (!empty($THEME->customcorners)) {
print_custom_corners_end();
}
echo '</td>';
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="right-column">';
if (!empty($THEME->customcorners)) {
print_custom_corners_start();
}
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
if (!empty($THEME->customcorners)) {
print_custom_corners_end();
}
echo '</td>';
}
echo '</tr></table>';
print_footer($this->course);
}
示例9: wiki_footer
function wiki_footer()
{
global $COURSE, $CFG;
///document ending
$PAGE = wiki_page_info('PAGE');
$pageblocks = wiki_page_info('pageblocks');
$editing = $PAGE->user_is_editing();
wiki_table_end();
/// The right column
//if there are not blocks on the right part then don't enter in this condition
if (!empty($pageblocks[BLOCK_POS_RIGHT])) {
//to work out the default widths need to check all blocks
$preferred_width_right = optional_param('preferred_width_right', blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), PARAM_INT);
//preferred_width_right sizes
//should be between BLOCK_x_MAX_WIDTH and BLOCK_x_MIN_WIDTH.
$preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
$preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
}
//if there are blocks on the right part, then they are placed
if (!empty($pageblocks[BLOCK_POS_RIGHT])) {
//checks if there are blocks to place on the right-hand side
if (!empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing)) {
$prop = new stdClass();
$prop->id = "right-column";
$prop->class = "blockcourse";
wiki_change_column($prop);
$prop = new stdClass();
$prop->width = $preferred_width_right . 'px';
wiki_table_start($prop);
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
wiki_table_end();
$prop = new stdClass();
}
}
wiki_table_end();
// select the teacher
$cm = wiki_param('cm');
$dfwiki = wiki_param('dfwiki');
wiki_print_teacher_selection($cm, $dfwiki);
wiki_div_end();
// content wrapper end
/// Finish the page
print_footer($COURSE);
}
示例10: page_print_position
/**
* Prints blocks for a given position
*
* @param array $pageblocks An array of blocks organized by position
* @param char $position Position that we are currently printing
* @return void
**/
function page_print_position($pageblocks, $position, $width)
{
global $PAGE, $THEME;
$editing = $PAGE->user_is_editing();
if ($editing || blocks_have_content($pageblocks, $position)) {
/// Figure out an appropriate ID
switch ($position) {
case BLOCK_POS_LEFT:
$id = 'left';
break;
case BLOCK_POS_RIGHT:
$id = 'right';
break;
case BLOCK_POS_CENTER:
$id = 'middle';
break;
default:
$id = $position;
break;
}
/// Figure out the width - more for routine than being functional. May want to impose a minimum width though
$width = bounded_number($width, blocks_preferred_width($pageblocks[$position]), $width);
/// Print it
if (is_numeric($width)) {
// default to px MR-263
$tdwidth = $width . 'px';
} else {
$tdwidth = $width;
}
echo "<td style=\"width: {$tdwidth}\" id=\"{$id}-column\">";
if (is_numeric($width) or strpos($width, 'px')) {
print_spacer(1, $width, false);
}
print_container_start();
if ($position == BLOCK_POS_CENTER) {
echo skip_main_destination();
page_frontpage_settings();
}
page_blocks_print_group($pageblocks, $position);
print_container_end();
echo '</td>';
} else {
// Empty column - no class, style or width
/// Figure out an appropriate ID
switch ($position) {
case BLOCK_POS_LEFT:
$id = 'left';
break;
case BLOCK_POS_RIGHT:
$id = 'right';
break;
case BLOCK_POS_CENTER:
$id = 'middle';
break;
default:
$id = $position;
break;
}
// we still want to preserve values unles
if ($width != '0') {
if (is_numeric($width)) {
// default to px MR-263
$tdwidth = $width . 'px';
} else {
$tdwidth = $width;
}
echo '<td style="width:' . $tdwidth . '" id="' . $id . '-column" > ';
if ($width != '0' and is_numeric($width) or strpos($width, 'px')) {
print_spacer(1, $width, false);
}
echo "</td>";
} else {
echo '<td></td>';
// 0 means no column anyway
}
}
}
示例11: admin_externalpage_print_footer
function admin_externalpage_print_footer($adminroot)
{
global $CFG, $PAGE, $SITE, $THEME;
if (!empty($SITE->fullname)) {
$pageblocks = blocks_setup($PAGE);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH);
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
if ($column != 'middle') {
array_shift($lt);
} else {
if ($column == 'middle') {
break;
}
}
}
foreach ($lt as $column) {
switch ($column) {
case 'left':
echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
if (!empty($THEME->customcorners)) {
print_custom_corners_start();
}
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
if (!empty($THEME->customcorners)) {
print_custom_corners_end();
}
echo '</td>';
break;
case 'middle':
if (!empty($THEME->customcorners)) {
print_custom_corners_end();
}
echo '</td>';
break;
case 'right':
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
if (!empty($THEME->customcorners)) {
print_custom_corners_start();
}
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
if (!empty($THEME->customcorners)) {
print_custom_corners_end();
}
echo '</td>';
}
break;
}
}
echo '</tr></table>';
}
print_footer();
}
示例12: print_heading
// ---------------------------------------------------------------------------------------------------------------
echo '<form action="settings.php" method="post" id="adminsettings">';
echo '<div class="settingsform clearfix">';
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
echo '<input type="hidden" name="return" value="' . $return . '" />';
print_heading($page->visiblename);
echo $page->output_html();
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges', 'admin') . '" /></div>';
echo '</div>';
echo '</form>';
print_container_end();
echo '</td>';
break;
case 'right':
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo '</td>';
}
break;
}
}
echo '</tr></table>';
}
if (!empty($CFG->adminusehtmleditor)) {
use_html_editor();
}
print_footer();
示例13: class_exists
}
}
// Note: Course ID is ignored outside OU
$editing = class_exists('ouflags') ? isediting($cm->course) : isediting();
// Display header. Because this pagelib class doesn't actually have a
// $buttontext parameter, there has to be a really evil hack
$PAGEWILLCALLSKIPMAINDESTINATION = true;
$PAGE->print_header($course->shortname . ': ' . format_string($forum->get_name()), null, '', $meta, $buttontext);
$forum->print_js($cm->id);
// The left column ...
if ($hasleft = !empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing)) {
print '<div id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print '</div>';
}
if ($hasright = !empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing)) {
print '<div id="right-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print '</div>';
}
$classes = trim(($hasleft ? 'has-left-column ' : '') . ($hasright ? 'has-right-column' : ''));
print "<div id='middle-column' class='{$classes}'>";
//adding a link to the computing guide
if (!@(include_once $CFG->dirroot . '/local/utils_shared.php')) {
//Only used for forumng within Core Moodle (not OU Moodle)
require_once 'local/utils_shared.php';
}
$computingguidelink = get_link_to_computing_guide('forumng');
print '<span class="computing-guide"> ' . $computingguidelink . '</span>';
// Display group selector if required
groups_print_activity_menu($cm, $forum->get_url(forum::PARAM_HTML));
示例14: print_footer
/**
* Prints the page footer.
*/
public function print_footer()
{
global $PAGE;
// Can only register if not logged in...
echo '</td>';
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
if (blocks_have_content($this->pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="right-column">';
blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_RIGHT);
echo '</td>';
}
/// Finish the page
echo '</tr></table>';
print_footer();
}
示例15: page_create_instance
$CFG->pagepath = $CFG->wwwroot . '/my/index.php';
$PAGE = page_create_instance($USER->id);
if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
$PAGE->section = $section;
}
$pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
/// Make sure that the curriculum block is actually on this user's My Moodle page instance.
if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) {
// if (!record_exists('block_instance', 'blockid', $cablockid, 'pageid', $USER->id,
// 'pagetype', 'my-index')) {
if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) {
//print_object('cablockid: ' . $cablockid);
blocks_execute_action($PAGE, $pageblocks, 'add', (int) $cablockid, true, false);
}
}
if ($edit != -1 and $PAGE->user_allowed_editing()) {
$USER->editing = $edit;
}
$PAGE->print_header($mymoodlestr);
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
echo '<tr valign="top">';
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
echo '</td>';
}
echo '<td valign="top" id="middle-column">';
if (blocks_have_content($pageblocks, BLOCK_POS_CENTRE) || $PAGE->user_is_editing()) {
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_CENTRE);
}