Example #1
0
                        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;
    }
}
?>

  </tr>
</table>

<?php 
print_footer('home');
// Please do not modify this line
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
 /**
  * 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();
 }
Example #4
0
$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) {
                $groupselect = " AND groupid = '{$currentgroup}'";
                $groupparam = "&amp;groupid={$currentgroup}";
            } else {
Example #5
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();
}
$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 #7
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);
}
Example #9
0
/**
* hook function from inside the theme.
* in this case, detect lack of $PAGE and do a horrible hack
* to get a consistent page format.
*/
function tao_local_header_hook()
{
    global $CFG;
    require_once $CFG->libdir . '/blocklib.php';
    require_once $CFG->libdir . '/pagelib.php';
    global $PAGE;
    if (!empty($PAGE)) {
        return true;
    }
    if (defined('ADMIN_STICKYBLOCKS')) {
        return true;
    }
    if (optional_param('inpopup')) {
        return true;
    }
    $lmin = empty($THEME->block_l_min_width) ? 100 : $THEME->block_l_min_width;
    $lmax = empty($THEME->block_l_max_width) ? 210 : $THEME->block_l_max_width;
    $rmin = empty($THEME->block_r_min_width) ? 100 : $THEME->block_r_min_width;
    $rmax = empty($THEME->block_r_max_width) ? 210 : $THEME->block_r_max_width;
    !defined('BLOCK_L_MIN_WIDTH') && define('BLOCK_L_MIN_WIDTH', $lmin);
    !defined('BLOCK_L_MAX_WIDTH') && define('BLOCK_L_MAX_WIDTH', $lmax);
    !defined('BLOCK_R_MIN_WIDTH') && define('BLOCK_R_MIN_WIDTH', $rmin);
    !defined('BLOCK_R_MAX_WIDTH') && define('BLOCK_R_MAX_WIDTH', $rmax);
    $PAGE = new tao_page_class_hack();
    $pageblocks = blocks_setup($PAGE, true);
    // we could replace this with a stickyblocks implementation, this is a proof of concept.
    $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH);
    echo '<table id="layout-table" summary="layout">
      <tr>
    ';
    echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
    ob_start();
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    $blockscontent = ob_get_clean();
    if (!$blockscontent) {
        $rec = (object) array('id' => 0, 'blockid' => 0, 'pageid' => 0, 'pagetype' => tao_page_class_hack::get_type(), 'position' => BLOCK_POS_LEFT, 'visible' => true, 'configdata' => '', 'weight' => 0);
        $pageblocks = array(BLOCK_POS_LEFT => array(0 => $rec));
        $pageblocks[BLOCK_POS_LEFT][0]->rec = $rec;
        $pageblocks[BLOCK_POS_LEFT][0]->obj = new tao_dummy_block($rec);
        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    } else {
        echo $blockscontent;
    }
    echo '</td>';
    echo '<td id="middle-column">';
    define('TAO_HEADER_OVERRIDDEN', 1);
}
Example #10
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();
}