diff -Naur moodle195+/admin/settings/appearance.php my-moodle195+/admin/settings/appearance.php
--- moodle195+/admin/settings/appearance.php	2009-06-02 12:35:02.000000000 +0200
+++ my-moodle195+/admin/settings/appearance.php	2009-10-19 10:42:03.000000000 +0200
@@ -78,6 +78,20 @@
     $temp = new admin_settingpage('mymoodle', get_string('mymoodle', 'admin'));
     $temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0));
     $temp->add(new admin_setting_configtext('mycoursesperpage', get_string('mycoursesperpage', 'admin'), get_string('configmycoursesperpage', 'admin'), 21, PARAM_INT));
+// CODE_CHANGE
+    $temp->add(new admin_setting_configcheckbox('courseordersemester', get_string('courseordersemester', 'my_hub'), get_string('config_courseordersemester', 'my_hub') , 0));
+    $temp->add(new admin_setting_configcheckbox('courseordersemester_user', get_string('courseordersemester_user', 'my_hub'), get_string('config_courseordersemester_user', 'my_hub') , 0));
+    $wintertermmonth = array("1" => strftime("%B", strtotime("1/1")), "2" => strftime("%B", strtotime("2/1")), "3" => strftime("%B", strtotime("3/1")), 
+    				"4" => strftime("%B", strtotime("4/1")), "5" => strftime("%B", strtotime("5/1")), "6" => strftime("%B", strtotime("6/1")), 
+    				"7" => strftime("%B", strtotime("7/1")), "8" => strftime("%B", strtotime("8/1")), "9" => strftime("%B", strtotime("9/1")), 
+    				"10" => strftime("%B", strtotime("10/1")), "11" => strftime("%B", strtotime("11/1")), "12" => strftime("%B", strtotime("12/1")));
+    $wintertermmonthdefault = array("1" => strftime("%B", strtotime("1/1")), "2" => strftime("%B", strtotime("2/1")), "3" => strftime("%B", strtotime("3/1")), 
+    				"10" => strftime("%B", strtotime("10/1")), "11" => strftime("%B", strtotime("11/1")), "12" => strftime("%B", strtotime("12/1")));
+	   
+   	$temp->add(new admin_setting_configmulticheckbox('courseordersemester_names',get_string('courseordersemester_names', 'my_hub'), get_string('config_courseordersemester_names', 'my_hub'), $wintertermmonthdefault, $wintertermmonth));  
+
+   	$temp->add(new admin_setting_configtextarea('mymoodleadminnote', get_string('mymoodleadminnote', 'my_hub'), get_string('config_mymoodleadminnote', 'my_hub'), clean_param('',PARAM_CLEANHTML))); 
+// End CODE_CHANGE
     $ADMIN->add('appearance', $temp);
 
     // new CFG variable for coursemanager (what roles to display)
diff -Naur moodle195+/my/index.php my-moodle195+/my/index.php
--- moodle195+/my/index.php	2009-06-02 12:34:41.000000000 +0200
+++ my-moodle195+/my/index.php	2009-10-19 10:43:36.000000000 +0200
@@ -6,7 +6,7 @@
     require_once($CFG->libdir.'/blocklib.php');
     require_once($CFG->dirroot.'/course/lib.php');
     require_once('pagelib.php');
-    
+
     require_login();
 
     $mymoodlestr = get_string('mymoodle','my');
@@ -27,6 +27,8 @@
 
     $edit        = optional_param('edit', -1, PARAM_BOOL);
     $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
+    // CODE_CHANGE
+    $sortorder       = optional_param('sortorder','', PARAM_ALPHA);
 
     $PAGE = page_create_instance($USER->id);
 
@@ -55,19 +57,96 @@
         print_container_end();
         echo '</td>';
     }
-    
+
             break;
             case 'middle':
-    
+
     echo '<td valign="top" id="middle-column">';
     print_container_start(TRUE);
 
 /// The main overview in the middle of the page
-    $courses_limit = 21;
+    /******************
+    * CODE_CHANGE     *
+    * Course sortorder, Term wise: getdate($course->startdate);
+    *******************/
+    $courses_limit = 21; // new in 1.9.5+
     if (!empty($CFG->mycoursesperpage)) {
         $courses_limit = $CFG->mycoursesperpage;
     }
-    $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, $courses_limit);
+    // $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, $courses_limit);
+
+	// if run without the admin/settings/appearence patch -> true
+	// $groupsemesterwise = true;
+	if ((!isset($CFG->courseordersemester)) || ($CFG->courseordersemester == 0)) {
+		$groupsemesterwise = false;
+	}
+	else{
+		$groupsemesterwise = true;
+		$uhash = '';
+		// Sortorder from DB
+		if (isset($CFG->courseordersemester_user) && ($CFG->courseordersemester_user == 1)) {
+			$prefs = get_user_preferences("groupsemesterwise", 1, $USER->id); // if not set, initially 1 = Std
+			if ((($prefs == 1) && ($sortorder == 'classic'))){
+				set_user_preferences(array("groupsemesterwise" => 0), $USER->id);
+				$prefs = 0;
+			} elseif (($prefs == 0) && ($sortorder == 'sem')){
+				set_user_preferences(array("groupsemesterwise" => 1), $USER->id);
+				$prefs = 1;
+			}
+		} else {
+			// Sortorder from Cookie
+			// identify the Cookie, e.g. for shared computers, avoid remapping courses <- user via the cookie
+			$uhash = hash('md5', $USER->id);
+			$mySortorder = $_COOKIE["mySortorder"];
+			echo '<script type="text/javascript">
+				  //<![CDATA[
+				  var expires = new Date();
+				  expires.setTime(expires.getTime() + (180 * 24 * 60 * 60 * 1000)); // 180 Days
+				  //]]>
+				  </script>';
+			if (empty($mySortorder)) {
+				if (empty($sortorder)){
+					$prefs = 1;	// if no Cookie set, initially 1 = Std
+				} else {
+					$prefs = 0;
+				}
+			}
+			// foreign Cookie
+			else if (!(( $mySortorder == 'show:'.$uhash ) || ( $mySortorder == 'hide:'.$uhash ))) {
+				$prefs = 1; // new Cookie set, initially 1 = Std
+				echo '<script type="text/javascript">
+				      //<![CDATA[
+				      document.cookie = \'mySortorder=show:'.$uhash.'; expires=\'+ expires.toGMTString();
+			          //]]>
+				      </script>';
+			// personal Cookie
+			} else {
+				// will cause problems if Cookies were enabled once and disabled afterwards,
+				// then always this Cookie based sortorder will be choosen (Cookie is locked)
+				if ($mySortorder == 'show:'.$uhash ){
+					$prefs = 1;
+				} else {
+					$prefs = 0;
+				}
+			}
+		}
+	}
+
+	if ($groupsemesterwise){
+		if ( $sortorder == 'sem' || $prefs){
+			// $courses  = get_my_courses($USER->id, 'startdate DESC, fullname ASC', '*', false, 2100);
+			$courses  = get_my_courses($USER->id, 'startdate DESC, fullname ASC', '*', false, $courses_limit);
+		}
+		else {
+		    // $courses = get_my_courses($USER->id, 'visible DESC,fullname ASC,sortorder DESC', '*', false, 2100); // alphabetic order in classic view
+		    $courses = get_my_courses($USER->id, 'visible DESC,fullname ASC,sortorder DESC', '*', false, $courses_limit); // alphabetic order in classic view
+		}
+	} else{ // end CODE_CHANGE
+		// limits the number of courses showing up
+		// $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, 21);
+		$courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false,  $courses_limit);
+	}
+
     $site = get_site();
     $course = $site; //just in case we need the old global $course hack
 
@@ -82,24 +161,154 @@
             $courses[$c->id]->lastaccess = 0;
         }
     }
-    
+
+	// begin CODE_CHANGE
+	// if set, insert an importand admin note to any myMoodle Site
+	if (isset($CFG->mymoodleadminnote) && (!empty($CFG->mymoodleadminnote))) {
+		print_simple_box($CFG->mymoodleadminnote,'center');
+	}
+
+	if ($groupsemesterwise){
+		$summertermname = stripslashes(get_string('courseordersemester_summerterm','my_hub'));
+		$wintertermname = stripslashes(get_string('courseordersemester_winterterm','my_hub'));
+		// calculate the months of the summer term
+		if (isset($CFG->courseordersemester_names)){
+			$WS = explode(",", $CFG->courseordersemester_names);
+			$SS = array( "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8", "9" , "10", "11", "12");
+			$SS = array_diff($SS, $WS);
+		} else {
+			// if run without the admin/settings/appearence patch
+			$SS = array(4,5,6,7,8,9);
+			$WS = array(1,10,11,12,2,3);
+		}
+		// current term
+		$acttime = getdate(time());
+		if (in_array($acttime['mon'],$SS)) {
+			$actsem = $acttime['year'].$summertermname;
+		} else {
+			$actsem = $acttime['year'].$wintertermname;
+		}
+		$sem_prev = '';
+	} // if ($groupsemesterwise)
+	// end CODE_CHANGE
+
     if (empty($courses)) {
         print_simple_box(get_string('nocourses','my'),'center');
     } else {
-        print_overview($courses);
+		// begin CODE_CHANGE
+		if ($groupsemesterwise){
+			if ( $sortorder == 'sem' || $prefs ){
+				// the sortorder switch
+				echo '<div class="semswitch"><div class="header"><div class="title"><a onclick="document.cookie = \'mySortorder=hide:'.$uhash.'; expires=\'+ expires.toGMTString();" href="'.$CFG->wwwroot.'/my/index.php?sortorder=classic">'.get_string('courseordersemester_semester', 'my_hub').'</a></div></div></div>';
+				// /*** Copy & Paste from: course/lib print_overview() ***/
+				$htmlarray = array();
+				if ($modules = get_records('modules')) {
+					foreach ($modules as $mod) {
+						if (file_exists(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php')) {
+							include_once(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php');
+							$fname = $mod->name.'_print_overview';
+							if (function_exists($fname)) {
+								$fname($courses,$htmlarray);
+							}
+						}
+					}
+				}
+				// /*** END: Copy & Paste from: course/lib print_overview() ***/
+				// accessability
+				$skip_text = get_string('courseordersemester_access', 'my_hub');
+				$show = get_string('show', 'moodle');
+				$hide = get_string('hide', 'moodle');
+
+				foreach ($courses as $course) {
+					$startdate = getdate($course->startdate);
+					$startdate_year = $startdate['year'];
+					$startdate_mon = $startdate['mon'];
+					if (in_array($startdate_mon, $SS)) {
+						$sem = $summertermname.' '.$startdate_year;
+						$secondhalf = ''; 				// e.g. WS 2008 / 2009
+					} else {
+						if ( $startdate_mon <= 6 ){		// January - July belong to the previous term
+							$startdate_year--;
+							$sem = $wintertermname.' '.$startdate_year;
+						} else {
+							$sem = $wintertermname.' '.$startdate_year;
+						}
+						$secondhalf = ' / '.($startdate_year + 1);
+					}
+					// if new term print the term name
+					if (($sem != $sem_prev) && ($sem != $actsem)) {
+						echo '<div class="semname"><div class="header"><div class="title">'.$sem.$secondhalf.'</div></div></div>';
+					}
+					// /*** from: course/lib print_overview() ***/
+					$linkcss = '';
+					if (empty($course->visible)) {
+						$linkcss = 'class="dimmed"';
+					}
+					// accessability
+					echo '<a href="#cb-'.$course->id.'" class="skip-course">'.$skip_text.' '.$course->id.'</a>';
+					echo '<div id="left-column">'; // no idea why, but necessary...
+					// the toggle/hide button
+					echo '<div id="'.$course->id.'" class="semblock"><div  class="header"><div class="title">
+							<input type="image" src="'.$CFG->pixpath.'/t/switch_minus.gif"
+								id="togglehide_'.$course->id.'"
+								onclick="elementToggleHide(this, true,  function(el) {return findParentNode(el, \'DIV\', \'semblock\'); }, \''.$show.'\', \''.$hide.'\'); return false;"
+								class="hide-show-image"
+								alt="'.$show.'/'.$hide.'" />';
+					// the coures title
+					print_heading('<a title="'. format_string($course->fullname).'" '.$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'. format_string($course->fullname).'</a>');
+					echo '</div></div>
+						<div class="content"><div class="coursebox">';
+					// the activities
+					if (array_key_exists($course->id,$htmlarray)) {
+						foreach ($htmlarray[$course->id] as $modname => $html) {
+							echo $html;
+						}
+					}
+					// /*** END: from: course/lib print_overview() ***/
+					echo '</div></div></div>';
+					// toggle / hide
+					echo '<script type="text/javascript">
+						  //<![CDATA[
+						  elementCookieHide("'.$course->id.'","'.$show.'","'.$hide.'");
+						  //]]>
+						  </script></div>';
+					// accessability
+					echo '<span id="cb-'.$course->id.'" class="skip-course-to"></span>';
+
+					$sem_prev = $sem;
+					unset($sem);
+				} 	// end for each
+
+			} 		// if ($prefs)
+			else {
+				// insert the sortorder switch
+				echo '<div class="semswitch"><div  class="header"><div class="title"><a onclick="document.cookie = \'mySortorder=show:'.$uhash.'; expires=\'+ expires.toGMTString();" href="'.$CFG->wwwroot.'/my/index.php?sortorder=sem">'.get_string('courseordersemester_classic', 'my_hub').'</a></div></div></div>';
+				print_overview($courses);
+			}
+		} else { // if ($groupsemesterwise)
+			// moodle std. my out
+    	    print_overview($courses);
+		}
     }
-    
+
     // if more than 20 courses
-    if (count($courses) > 20) {
-        echo '<br />...';  
+    // if (count($courses) > 20) {
+    if ($groupsemesterwise && (count($courses) > 2099)){
+        echo '<br />...';
+    } elseif(!$groupsemesterwise && (count($courses) > 20)){
+        echo '<br />...';
     }
-    
+    /****** ENDE ******
+    * CODE_CHANGE     *
+    * Course sortorder, Term wise: getdate($course->startdate);
+    ********************/
+
     print_container_end();
     echo '</td>';
-    
+
             break;
             case 'right':
-            
+
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
 
     if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
