Updated small MP3 player to handle autoPlay (by Andrew Walker, Alton College)
[moodle.git] / my / index.php
CommitLineData
3131d5c6 1<?php // %Id%
0d6b9d4f 2
3 // this is the 'my moodle' page
4
5 require_once('../config.php');
6 require_once($CFG->libdir.'/blocklib.php');
3131d5c6 7 require_once($CFG->dirroot.'/course/lib.php');
0d6b9d4f 8 require_once('pagelib.php');
9
10 require_login();
11
fdaa6006 12 $mymoodlestr = get_string('mymoodle','my');
13
14 if (isguest()) {
15 $wwwroot = $CFG->wwwroot.'/login/index.php';
16 if (!empty($CFG->loginhttps)) {
2c3432e6 17 $wwwroot = str_replace('http:','https:', $wwwroot);
fdaa6006 18 }
19
20 print_header($mymoodlestr);
21 notice_yesno(get_string('noguest', 'my').'<br /><br />'.get_string('liketologin'),
092dcfa4 22 $wwwroot, $CFG->wwwroot);
fdaa6006 23 print_footer();
24 die();
25 }
26
27
d2b23346 28 $edit = optional_param('edit', -1, PARAM_BOOL);
29 $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
0d6b9d4f 30
31 $PAGE = page_create_instance($USER->id);
32
ee6055eb 33 $pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
0d6b9d4f 34
d2b23346 35 if (($edit != -1) and $PAGE->user_allowed_editing()) {
36 $USER->editing = $edit;
0d6b9d4f 37 }
38
fdaa6006 39 $PAGE->print_header($mymoodlestr);
0d6b9d4f 40
41 echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
42 echo '<tr valign="top">';
43
44
45 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
46
47 if(blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
48 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
49 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
50 echo '</td>';
51 }
52
53 echo '<td valign="top" width="*" id="middle-column">';
3131d5c6 54
55/// The main overview in the middle of the page
56 $courses = get_my_courses($USER->id);
57 $site = get_site();
58
59 if (array_key_exists($site->id,$courses)) {
60 unset($courses[$site->id]);
61 }
62
63 foreach ($courses as $course) {
64 if (isset($USER->timeaccess) && array_key_exists($course->id,$USER->timeaccess)) {
65 $courses[$course->id]->lastaccess = $USER->timeaccess[$course->id];
66 } else {
67 $courses[$course->id]->lastaccess = 0;
68 }
69 }
70
71 if (empty($courses)) {
72 print_simple_box(get_string('nocourses','my'),'center');
73 } else {
74 print_overview($courses);
75 }
76
77
0d6b9d4f 78 echo '</td>';
79
80 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
81
3131d5c6 82 if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
0d6b9d4f 83 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="right-column">';
84 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
85 echo '</td>';
86 }
87
88
89 /// Finish the page
90 echo '</tr></table>';
91
92 print_footer();
93
3131d5c6 94?>