Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / course / format / social / format.php
bloba12a6f8b99299bfa1d596c9ec5258721178c8c65
1 <?php // $Id$
2 // format.php - course format featuring social forum
3 // included from view.php
5 // Bounds for block widths
6 // more flexible for theme designers taken from theme config.php
7 $lmin = (empty($THEME->block_l_min_width)) ? 100 : $THEME->block_l_min_width;
8 $lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width;
9 $rmin = (empty($THEME->block_r_min_width)) ? 100 : $THEME->block_r_min_width;
10 $rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width;
12 define('BLOCK_L_MIN_WIDTH', $lmin);
13 define('BLOCK_L_MAX_WIDTH', $lmax);
14 define('BLOCK_R_MIN_WIDTH', $rmin);
15 define('BLOCK_R_MAX_WIDTH', $rmax);
17 $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
18 BLOCK_L_MAX_WIDTH);
19 $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
20 BLOCK_R_MAX_WIDTH);
22 $strgroups = get_string('groups');
23 $strgroupmy = get_string('groupmy');
24 $editing = $PAGE->user_is_editing();
26 echo '<table id="layout-table" cellspacing="0" summary="'.get_string('layouttable').'">';
27 echo '<tr>';
29 if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
30 echo '<td style="width:'.$preferred_width_left.'px" id="left-column">';
31 print_container_start();
32 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
33 print_container_end();
34 echo '</td>';
37 echo '<td id="middle-column">';
38 print_container_start();
39 echo skip_main_destination();
40 if ($forum = forum_get_course_forum($course->id, 'social')) {
41 print_heading_block(get_string('socialheadline'));
43 $cm = get_coursemodule_from_instance('forum', $forum->id);
44 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
45 echo '<div class="subscribelink">', forum_get_subscribe_link($forum, $context), '</div>';
46 forum_print_latest_discussions($course, $forum, 10, 'plain', '', false);
48 } else {
49 notify('Could not find or create a social forum here');
51 print_container_end();
52 echo '</td>';
54 // The right column
55 if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
56 echo '<td style="width:'.$preferred_width_right.'px" id="right-column">';
57 print_container_start();
58 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
59 print_container_end();
60 echo '</td>';
63 echo '</tr>';
64 echo '</table>';