2006-05-29 05:56:28 +00:00
|
|
|
<?php // $Id$
|
2005-08-16 00:25:39 +00:00
|
|
|
|
|
|
|
// this is the 'my moodle' page
|
|
|
|
|
|
|
|
require_once('../config.php');
|
|
|
|
require_once($CFG->libdir.'/blocklib.php');
|
2006-04-25 13:19:52 +00:00
|
|
|
require_once($CFG->dirroot.'/course/lib.php');
|
2005-08-16 00:25:39 +00:00
|
|
|
require_once('pagelib.php');
|
|
|
|
|
|
|
|
require_login();
|
|
|
|
|
2005-10-30 20:10:43 +00:00
|
|
|
$mymoodlestr = get_string('mymoodle','my');
|
|
|
|
|
|
|
|
if (isguest()) {
|
|
|
|
$wwwroot = $CFG->wwwroot.'/login/index.php';
|
|
|
|
if (!empty($CFG->loginhttps)) {
|
2006-05-15 21:36:46 +00:00
|
|
|
$wwwroot = str_replace('http:','https:', $wwwroot);
|
2005-10-30 20:10:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print_header($mymoodlestr);
|
|
|
|
notice_yesno(get_string('noguest', 'my').'<br /><br />'.get_string('liketologin'),
|
2005-10-30 20:20:09 +00:00
|
|
|
$wwwroot, $CFG->wwwroot);
|
2005-10-30 20:10:43 +00:00
|
|
|
print_footer();
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-23 20:58:06 +00:00
|
|
|
$edit = optional_param('edit', -1, PARAM_BOOL);
|
|
|
|
$blockaction = optional_param('blockaction', '', PARAM_ALPHA);
|
2005-08-16 00:25:39 +00:00
|
|
|
|
|
|
|
$PAGE = page_create_instance($USER->id);
|
|
|
|
|
2005-08-23 04:03:56 +00:00
|
|
|
$pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
|
2005-08-16 00:25:39 +00:00
|
|
|
|
2006-04-23 20:58:06 +00:00
|
|
|
if (($edit != -1) and $PAGE->user_allowed_editing()) {
|
|
|
|
$USER->editing = $edit;
|
2005-08-16 00:25:39 +00:00
|
|
|
}
|
|
|
|
|
2005-10-30 20:10:43 +00:00
|
|
|
$PAGE->print_header($mymoodlestr);
|
2005-08-16 00:25:39 +00:00
|
|
|
|
|
|
|
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>';
|
|
|
|
}
|
|
|
|
|
2006-09-25 14:40:26 +00:00
|
|
|
echo '<td valign="top" id="middle-column">';
|
2006-04-25 13:19:52 +00:00
|
|
|
|
|
|
|
/// The main overview in the middle of the page
|
2007-02-13 04:09:11 +00:00
|
|
|
|
|
|
|
// limits the number of courses showing up
|
|
|
|
$courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, 21);
|
2006-04-25 13:19:52 +00:00
|
|
|
$site = get_site();
|
2006-05-29 05:56:28 +00:00
|
|
|
$course = $site; //just in case we need the old global $course hack
|
2006-04-25 13:19:52 +00:00
|
|
|
|
|
|
|
if (array_key_exists($site->id,$courses)) {
|
|
|
|
unset($courses[$site->id]);
|
|
|
|
}
|
|
|
|
|
2006-05-29 05:56:28 +00:00
|
|
|
foreach ($courses as $c) {
|
2006-12-05 07:00:43 +00:00
|
|
|
if (isset($USER->lastcourseaccess[$c->id])) {
|
|
|
|
$courses[$c->id]->lastaccess = $USER->lastcourseaccess[$c->id];
|
2006-04-25 13:19:52 +00:00
|
|
|
} else {
|
2006-05-29 05:56:28 +00:00
|
|
|
$courses[$c->id]->lastaccess = 0;
|
2006-04-25 13:19:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($courses)) {
|
|
|
|
print_simple_box(get_string('nocourses','my'),'center');
|
|
|
|
} else {
|
|
|
|
print_overview($courses);
|
|
|
|
}
|
2007-02-13 04:09:11 +00:00
|
|
|
|
|
|
|
// if more than 20 courses
|
|
|
|
if (count($courses) > 20) {
|
|
|
|
echo '<br />...';
|
|
|
|
}
|
2006-04-25 13:19:52 +00:00
|
|
|
|
2005-08-16 00:25:39 +00:00
|
|
|
echo '</td>';
|
|
|
|
|
|
|
|
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
|
|
|
|
|
2006-04-25 13:19:52 +00:00
|
|
|
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
|
2005-08-16 00:25:39 +00:00
|
|
|
echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="right-column">';
|
|
|
|
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
|
|
|
echo '</td>';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Finish the page
|
|
|
|
echo '</tr></table>';
|
|
|
|
|
|
|
|
print_footer();
|
|
|
|
|
2006-04-25 13:19:52 +00:00
|
|
|
?>
|