Example #1
0
  <tr>
  <?php 
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
    switch ($column) {
        case 'left':
            if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
                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':
            echo '<td id="middle-column">' . skip_main_destination();
            print_container_start();
            /// Print Section
            if ($SITE->numsections > 0) {
                if (!($section = get_record('course_sections', 'course', $SITE->id, 'section', 1))) {
                    delete_records('course_sections', 'course', $SITE->id, 'section', 1);
                    // Just in case
                    $section->course = $SITE->id;
                    $section->section = 1;
                    $section->summary = '';
                    $section->sequence = '';
                    $section->visible = 1;
                    $section->id = insert_record('course_sections', $section);
                }
                if (!empty($section->sequence) or !empty($section->summary) or $editing) {
                    print_box_start('generalbox sitetopic');
    $forum = $discussion->get_forum();
    $cm = $forum->get_course_module();
    $course = $forum->get_course();
    // Check permission for change
    $discussion->require_edit();
    // Is this the actual delete?
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        if ($delete) {
            $discussion->delete();
            redirect($forum->get_url(forum::PARAM_PLAIN));
        } else {
            $discussion->undelete();
            redirect('../../discuss.php?' . $discussion->get_link_params(forum::PARAM_PLAIN));
        }
    }
    // Confirm page. Work out navigation for header
    $pagename = get_string($delete ? 'deletediscussion' : 'undeletediscussion', 'forumng', $discussion->get_subject(false));
    $navigation = array();
    $navigation[] = array('name' => shorten_text(htmlspecialchars($discussion->get_subject())), 'link' => $discussion->get_url(), 'type' => 'forumng');
    $navigation[] = array('name' => $pagename, 'type' => 'forumng');
    $PAGEWILLCALLSKIPMAINDESTINATION = true;
    print_header_simple(format_string($forum->get_name()) . ': ' . $pagename, "", build_navigation($navigation, $cm), "", "", true, '', navmenu($course, $cm));
    print skip_main_destination();
    // Show confirm option
    $confirmstring = get_string($delete ? 'confirmdeletediscussion' : 'confirmundeletediscussion', 'forumng');
    notice_yesno($confirmstring, 'delete.php', '../../discuss.php', array('d' => $discussion->get_id(), 'delete' => $delete, 'clone' => $cloneid), array('d' => $discussion->get_id(), 'clone' => $cloneid), 'post', 'get');
    // Display footer
    print_footer($course);
} catch (forum_exception $e) {
    forum_utils::handle_exception($e);
}
/**
 * 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 #4
0
 switch ($column) {
     case 'left':
         /// The left column ...
         if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
             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':
         /// Start main column
         echo '<td id="middle-column">';
         print_container_start();
         echo skip_main_destination();
         print_heading_block(get_string('weeklyoutline'), 'outline');
         echo '<table class="weeks" width="100%" summary="' . get_string('layouttable') . '">';
         /// If currently moving a file then show the current clipboard
         if (ismoving($course->id)) {
             $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname)));
             $strcancel = get_string('cancel');
             echo '<tr class="clipboard">';
             echo '<td colspan="3">';
             echo $stractivityclipboard . '&nbsp;&nbsp;(<a href="mod.php?cancelcopy=true&amp;sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)';
             echo '</td>';
             echo '</tr>';
         }
         /// Print Section 0 with general activities
         $section = 0;
         $thissection = $sections[$section];
 /**
  * Prints the header and breadcrumbs for a page 'within' a forum.
  * @param string $pagename Name of page
  * @param array $navigation If specified, adds extra elements before the
  *   page name
  */
 public function print_subpage_header($pagename, $navigation = array())
 {
     global $PAGEWILLCALLSKIPMAINDESTINATION;
     $PAGEWILLCALLSKIPMAINDESTINATION = true;
     $navigation[] = array('name' => $pagename, 'type' => 'forumng');
     print_header_simple(format_string($this->get_name()) . ': ' . $pagename, "", build_navigation($navigation, $this->get_course_module()), "", "", true, '', navmenu($this->get_course(), $this->get_course_module()));
     print skip_main_destination();
 }