| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php // $Id: index.php,v 1.16.2.2 2008/04/09 02:43:51 dongsheng Exp $ 2 3 // this is the 'my moodle' page 4 5 require_once ('../config.php'); 6 require_once($CFG->libdir.'/blocklib.php'); 7 require_once($CFG->dirroot.'/course/lib.php'); 8 require_once ('pagelib.php'); 9 10 require_login(); 11 12 $mymoodlestr = get_string('mymoodle','my'); 13 14 if (isguest()) { 15 $wwwroot = $CFG->wwwroot.'/login/index.php'; 16 if (!empty($CFG->loginhttps)) { 17 $wwwroot = str_replace('http:','https:', $wwwroot); 18 } 19 20 print_header($mymoodlestr); 21 notice_yesno(get_string('noguest', 'my').'<br /><br />'.get_string('liketologin'), 22 $wwwroot, $CFG->wwwroot); 23 print_footer(); 24 die(); 25 } 26 27 28 $edit = optional_param('edit', -1, PARAM_BOOL); 29 $blockaction = optional_param('blockaction', '', PARAM_ALPHA); 30 31 $PAGE = page_create_instance($USER->id); 32 33 $pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH); 34 35 if (($edit != -1) and $PAGE->user_allowed_editing()) { 36 $USER->editing = $edit; 37 } 38 39 $PAGE->print_header($mymoodlestr); 40 41 echo '<table id="layout-table">'; 42 echo '<tr valign="top">'; 43 44 $lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable; 45 foreach ($lt as $column) { 46 switch ($column) { 47 case 'left': 48 49 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210); 50 51 if(blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) { 52 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">'; 53 print_container_start(); 54 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); 55 print_container_end(); 56 echo '</td>'; 57 } 58 59 break; 60 case 'middle': 61 62 echo '<td valign="top" id="middle-column">'; 63 print_container_start(TRUE); 64 65 /// The main overview in the middle of the page 66 67 // limits the number of courses showing up 68 $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, 21); 69 $site = get_site(); 70 $course = $site; //just in case we need the old global $course hack 71 72 if (array_key_exists($site->id,$courses)) { 73 unset($courses[$site->id]); 74 } 75 76 foreach ($courses as $c) { 77 if (isset($USER->lastcourseaccess[$c->id])) { 78 $courses[$c->id]->lastaccess = $USER->lastcourseaccess[$c->id]; 79 } else { 80 $courses[$c->id]->lastaccess = 0; 81 } 82 } 83 84 if (empty($courses)) { 85 print_simple_box(get_string('nocourses','my'),'center'); 86 } else { 87 print_overview($courses); 88 } 89 90 // if more than 20 courses 91 if (count($courses) > 20) { 92 echo '<br />...'; 93 } 94 95 print_container_end(); 96 echo '</td>'; 97 98 break; 99 case 'right': 100 101 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210); 102 103 if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) { 104 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="right-column">'; 105 print_container_start(); 106 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); 107 print_container_end(); 108 echo '</td>'; 109 } 110 break; 111 } 112 } 113 114 /// Finish the page 115 echo '</tr></table>'; 116 117 print_footer(); 118 119 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |