Example #1
0
 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>';
 }
Example #2
0
 /**
  * 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);
 }
Example #3
0
/**
 * Print footer on admin page - please use normal print_footer() instead
 */
function admin_externalpage_print_footer()
{
    global $CFG, $PAGE, $SITE, $THEME;
    define('ADMIN_EXT_FOOTER_PRINTED', 'true');
    if (!empty($SITE->fullname)) {
        $pageblocks = blocks_setup($PAGE);
        $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH);
        $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">';
                    print_container_start();
                    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
                    print_container_end();
                    echo '</td>';
                    break;
                case 'middle':
                    print_container_end();
                    $THEME->open_header_containers--;
                    // this is hacky workaround for the error()/notice() autoclosing problems on admin pages
                    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>';
    }
    print_footer();
}
Example #4
0
$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) {
Example #5
0
/**
 * 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>";
    }
}
  <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>';
Example #7
0
                 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>';
Example #8
0
                            echo '<a href="view.php?id=' . $course->id . '&amp;random=' . rand(1, 10000) . '&amp;section=' . $section . '&amp;move=1&amp;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 . '&amp;', $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>';
Example #9
0
 /**
  * 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);
 }
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);
}
/**
 * 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
        }
    }
}
Example #12
0
/**
 * This is not ideal, but checks to see if a
 * column has "block" content.
 *
 * In the future, it would be nice if the lesson
 * media file, timer and navigation were blocks
 * then this would be unnecessary.
 *
 * @uses $CFG
 * @uses $PAGE
 * @param object $lesson Full lesson record object
 * @param array $pageblocks An array of block instances organized by left and right columns
 * @param string $column Pass either BLOCK_POS_RIGHT or BLOCK_POS_LEFT constants
 * @return boolean
 **/
function lesson_blocks_have_content($lesson, $pageblocks, $column)
{
    global $CFG, $PAGE;
    // First check lesson conditions
    if ($column == BLOCK_POS_RIGHT) {
        $managecap = false;
        if ($cm = get_coursemodule_from_instance('lesson', $lesson->id, $lesson->course)) {
            $managecap = has_capability('mod/lesson:manage', get_context_instance(CONTEXT_MODULE, $cm->id));
        }
        if ($lesson->timed and !$managecap or !empty($lesson->mediafile)) {
            return true;
        }
    } else {
        if ($column == BLOCK_POS_LEFT) {
            if ($lesson->displayleft) {
                return true;
            }
        }
    }
    if (!empty($CFG->showblocksonmodpages)) {
        if (blocks_have_content($pageblocks, $column) || $PAGE->user_is_editing()) {
            return true;
        }
    }
    return false;
}
Example #13
0
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();
}
Example #14
0
                // ---------------------------------------------------------------------------------------------------------------
                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();
     }
 }
 // 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));
Example #16
0
 /**
  * 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();
 }
$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);
}
Example #18
0
                        print_whole_category_list(NULL, NULL, NULL, -1, true);
                        print_box_end();
                        print_course_search('', false, 'short');
                        break;
                    case FRONTPAGETOPICONLY:
                        // Do nothing!!  :-)
                        break;
                }
                echo '<br />';
            }
            print_container_end();
            echo '</td>';
            break;
        case 'right':
            // The right column
            if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing || $PAGE->user_allowed_editing()) {
                echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
                print_container_start();
                if ($PAGE->user_allowed_editing()) {
                    echo '<div style="text-align:center">' . update_course_icon($SITE->id) . '</div>';
                    echo '<br />';
                }
                blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
                print_container_end();
                echo '</td>';
            }
            break;
    }
}
?>
Example #19
0
        print "<p style=\"font-size: x-small;\"><a href=\"{$CFG->wwwroot}/cms";
        print "/index.php?course={$courseid}&amp;sesskey={$USER->sesskey}\">{$stradmin}</a></p>\n";
    }
}
print_simple_box_end();
echo '</td>' . "\n";
// The right column
$showblocks = $pagedata->showblocks && (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) ? 1 : 0;
if (has_capability('moodle/legacy:editingteacher', $context, $USER->id)) {
    $showblocks = true;
}
if ($showblocks) {
    echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
    if (has_capability('moodle/legacy:admin', $context, $USER->id, false)) {
        echo '<div align="center">' . update_course_icon($course->id) . '</div>';
        if (!$pagedata->showblocks && blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
            echo '<br />' . "\n" . '<div class="cms-warning" align="center">' . get_string('nonvisibleblocks', 'cms') . '</div>' . "\n";
        }
        echo '<br />';
    }
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
    echo '</td>' . "\n";
}
echo '</tr>' . "\n";
echo '</table>' . "\n";
if (defined('SITEID') && SITEID == $course->id) {
    // Close the page when we're on site level.
    echo '</div>';
    // content wrapper end
    print_footer(NULL, $course);
}