MyMoodle: new /my/ page, contains course overview (module based, forum done). User...
[moodle.git] / my / index.php
CommitLineData
0d6b9d4f 1<?php
2
3 // this is the 'my moodle' page
4
5 require_once('../config.php');
6 require_once($CFG->libdir.'/blocklib.php');
7 require_once('pagelib.php');
8
9 require_login();
10
11 $edit = optional_param('edit', '');
12 $blockaction = optional_param('blockaction');
13
14 $PAGE = page_create_instance($USER->id);
15
16 $pageblocks = blocks_get_by_page_pinned($PAGE);
17 if (!empty($blockaction)) {
18 blocks_execute_url_action($PAGE, $pageblocks);
19 // This re-query could be eliminated by judicious programming in blocks_execute_action(),
20 // but I 'm not sure if it's worth the complexity increase...
21 $pageblocks = blocks_get_by_page_pinned($PAGE);
22 }
23
24
25 if (!empty($edit) && $PAGE->user_allowed_editing()) {
26 if ($edit == 'on') {
27 $USER->editing = true;
28 } else if ($edit == 'off') {
29 $USER->editing = false;
30 }
31 }
32
33 $PAGE->print_header(get_string('mymoodle','my'));
34
35 echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
36 echo '<tr valign="top">';
37
38
39 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
40
41 if(blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
42 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
43 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
44 echo '</td>';
45 }
46
47 echo '<td valign="top" width="*" id="middle-column">';
48 include('overview.php');
49 echo '</td>';
50
51 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
52
53 if(blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
54 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="right-column">';
55 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
56 echo '</td>';
57 }
58
59
60 /// Finish the page
61 echo '</tr></table>';
62
63 print_footer();
64
65
66
67?>