Index: course/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/course/lib.php,v
retrieving revision 1.576
diff -u -r1.576 lib.php
--- course/lib.php	15 Apr 2008 07:23:39 -0000	1.576
+++ course/lib.php	16 Apr 2008 15:13:37 -0000
@@ -783,19 +783,56 @@
             }
         }
     }
-    foreach ($courses as $course) {
-        print_simple_box_start('center', '100%', '', 5, "coursebox");
-        $linkcss = '';
+    
+    // get block content
+    if ($blocks = get_records('block')) {
+        foreach ($blocks as $block) {
+            if (file_exists(dirname(dirname(__FILE__)).'/blocks/'.$block->name.'/block_'.$block->name.'.php')) {
+                require_once(dirname(dirname(__FILE__)).'/blocks/'.$block->name.'/block_'.$block->name.'.php');
+                call_user_func_array(array('block_'.$block->name,'print_overview'),array($courses,&$htmlarray)); 
+            }
+        } 
+    } 
+    
+    blog_print_overview($courses,&$htmlarray);
+    
+    foreach ($courses as $course) {     	
+        print_box_start("coursebox");
+        //  Now put a padding div inside the box
+        print_box_start("padded");
+        if (!empty($CFG->allowusermycoursehiding)){
+            $strshow = addslashes_js(get_string('showblocka', 'access',$course->fullname));
+            $strhide = addslashes_js(get_string('hideblocka', 'access',$course->fullname));
+ 
+            echo '<div style="float:left;" ><input type="image" src="'.$CFG->pixpath.'/t/switch_minus.gif" '. 
+                'id="'.$course->id.'" onclick="elementToggleHide(this, true, function(el) {'.
+                'return findParentNode(el, \'DIV\', \'padded\'); },'.
+                ' \''.$strshow.'\', \''.$strhide.'\'); return false;" '.
+                'alt="'.$strhide.'" title="'.$strhide.'" class="hide-show-image" /></div>';
+         }
+        
+    	$linkcss = '';
         if (empty($course->visible)) {
             $linkcss = 'class="dimmed"';
         }
         print_heading('<a title="'. format_string($course->fullname).'" '.$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'. format_string($course->fullname).'</a>');
+
+        print_box_start("hidediv");
+        // and the roles
+        $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+        if ($rolestring = get_user_roles_in_context($USER->id, $coursecontext)) {
+            echo ' '. get_string('roles').':'. format_string($rolestring, false).'<br/><br/>';
+        }
+
         if (array_key_exists($course->id,$htmlarray)) {
             foreach ($htmlarray[$course->id] as $modname => $html) {
                 echo $html;
             }
         }
-        print_simple_box_end();
+        //  Close all divs
+        print_box_end();
+        print_box_end();
+        print_box_end();
     }
 }
 
Index: my/index.php
===================================================================
RCS file: /cvsroot/moodle/moodle/my/index.php,v
retrieving revision 1.18
diff -u -r1.18 index.php
--- my/index.php	9 Apr 2008 02:46:55 -0000	1.18
+++ my/index.php	16 Apr 2008 15:13:37 -0000
@@ -6,6 +6,7 @@
     require_once($CFG->libdir.'/blocklib.php');
     require_once($CFG->dirroot.'/course/lib.php');
     require_once('pagelib.php');
+    require_once( $CFG->dirroot.'/blog/lib.php' );
     
     require_login();
 
@@ -69,6 +70,13 @@
     $site = get_site();
     $course = $site; //just in case we need the old global $course hack
 
+   if (!empty($CFG->showsiteactivity)) {
+
+        //Now get the site course record and print the module entries for that.
+        print_site_overview( $site, $courses );
+        print_heading( get_string( 'mycourses', 'my' ) ); 
+    }
+
     if (array_key_exists($site->id,$courses)) {
         unset($courses[$site->id]);
     }
@@ -116,4 +124,70 @@
 
     print_footer();
 
+    // function to output site level activity
+    function print_site_overview( $site, $courses ) {
+
+        global $CFG, $USER;
+
+        //The lastaccess time for the site course is not held - so use lastlogin.
+        $site->lastaccess = $USER->lastlogin;
+        $sitearr = array( $site->id => $site );
+
+        $htmlarray = array();
+        if ($modules = get_records('modules')) {
+            foreach ($modules as $mod) {
+                if (file_exists(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php')) {
+                    require_once(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php');
+                    $fname = $mod->name.'_print_overview';
+                    if (function_exists($fname)) {
+                        $fname($sitearr,$htmlarray);
+                    }
+                }
+            }
+        }
+
+       if ($blocks = get_records('block')) {
+            foreach ($blocks as $block) {
+                if (file_exists(dirname(dirname(__FILE__)).'/blocks/'.$block->name.'/block_'.$block->name.'.php')) {
+                    require_once(dirname(dirname(__FILE__)).'/blocks/'.$block->name.'/block_'.$block->name.'.php');
+                    call_user_func_array(array('block_'.$block->name,'print_overview'),array($sitearr,&$htmlarray)); 
+                }
+            }
+        }
+
+        blog_print_overview($sitearr,&$htmlarray);
+
+        if( !(array_key_exists($site->id,$htmlarray) ) && empty( $blogoverview ) ){
+             print_simple_box(get_string('noactivity','my'),'center');
+        }else{
+
+            print_box_start('coursebox', 'mymoodlebox');
+            //  Now put a padding div inside the box
+            print_box_start('padded', 'mymoodlecontent');
+
+             if (!empty($CFG->allowusermycoursehiding)){
+                $strshow = addslashes_js(get_string('showblocka', 'access',$site->fullname));
+                $strhide = addslashes_js(get_string('hideblocka', 'access',$site->fullname));
+                echo '<div style="float:left;" ><input type="image" src="'.$CFG->pixpath.'/t/switch_minus.gif" '. 
+                'id="'.$site->id.'" onclick="elementToggleHide(this, true, function(el) {'.
+                'return findParentNode(el, \'DIV\', \'padded\'); },'.
+                ' \''.$strshow.'\', \''.$strhide.'\'); return false;" '.
+                'alt="'.$strhide.'" title="'.$strhide.'" class="hide-show-image" /></div>';
+            }
+            print_heading($site->fullname.get_string( 'sitelevelactivity', 'my' ));
+
+            print_box_start('hidediv');
+
+            if (array_key_exists($site->id,$htmlarray)) {
+                foreach ($htmlarray[$site->id] as $modname => $html) {
+                    echo $html;
+                }
+            }
+
+            //  Close both divs
+            print_box_end();
+            print_box_end();
+            print_box_end();
+        }
+    }
 ?>
Index: blog/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/blog/lib.php,v
retrieving revision 1.89
diff -u -r1.89 lib.php
--- blog/lib.php	16 Apr 2008 09:05:53 -0000	1.89
+++ blog/lib.php	16 Apr 2008 15:13:36 -0000
@@ -696,4 +696,70 @@
                                  WHERE module = 'blog'
                                    AND courseid = 0");
     }
+
+   /**
+    * This function returns a summary of all the postings since the current user
+    * last logged in.  (Analogous to the print_overview function found in some
+    * modules).
+    */
+    function blog_print_overview($courses,$htmlarray ){
+
+        global $USER, $CFG, $SITE;
+
+        $sitecontext = get_context_instance(CONTEXT_SYSTEM, $SITE->id);
+
+        if (!has_capability('moodle/blog:view', $sitecontext) || $CFG->bloglevel < BLOG_COURSE_LEVEL) {
+            return;
+        }
+        
+        if($CFG->bloglevel==BLOG_COURSE_LEVEL){
+         	if (array_key_exists($SITE->id,$courses)) {
+        		return;
+            }
+            $filtertype='course';
+        } else {
+        	if (!array_key_exists($SITE->id,$courses)) {
+        		return;
+        	}
+        	$filtertype='site';
+        }
+
+        foreach($courses as $course) {
+            $new = array();
+        	$entries = blog_fetch_entries('',10,'',$filtertype,$course->id,'','','lastmodified DESC',false);
+	        foreach($entries as $entry) {
+	            if ($entry->lastmodified > $course->lastaccess && $entry->userid != $USER->id) {
+                    array_push($new,$entry);
+	            }
+	        }
+
+	        $count = count($new);
+	        $strblogs = get_string('blogs','blog');
+	
+	        if( $count > 0 ){
+	            $strposts = get_string('blogentries','blog');
+	            if( $count == 1 ){
+	                $strnumpostsince = get_string('overviewnumpostsince1','blog');
+	            }else{
+	                $strnumpostsince = get_string('overviewnumpostsince','blog');
+	            }
+	
+	            if ($filtertype=='course') {
+	            	$filterselect = $course->id;
+	            } else {
+	            	$filterselect = '';
+	            }
+	            
+	            $str = '<div class="overview blogs"><div class="name">'.
+	                '<a title="'.$strposts.'" href="'.
+	                $CFG->wwwroot.'/blog/index.php?filtertype='.$filtertype.'&filterselect='.$filterselect.'">'.
+	                $strposts.'</a></div>';
+	            $str .= '<div class="info">';
+	            $str .= $count.' '.$strnumpostsince;
+	            $str .= '</div></div>';
+	
+	            $htmlarray[$course->id]['blog'] = $str;
+	        }
+	    }
+    }
 ?>
