Skip to content
Browse files

MDL-28945: Fix course/activity completion reports initial selection b…

…roken
  • Loading branch information...
1 parent 6731a04 commit 1f186372eac98014a3fa282ac4718c0bcc5e51e0 @tlevi tlevi committed with sammarshallou Aug 16, 2011
Showing with 36 additions and 14 deletions.
  1. +18 −7 course/report/completion/index.php
  2. +18 −7 course/report/progress/index.php
View
25 course/report/completion/index.php
@@ -241,22 +241,25 @@ function csv_quote($value) {
foreach ($initials as $initial) {
$var = 'si'.$initial;
+ $othervar = $initial == 'first' ? 'silast' : 'sifirst';
+ $othervar = $$othervar != 'all' ? "&{$othervar}={$$othervar}" : '';
+
$pagingbar .= ' <div class="initialbar '.$initial.'initial">';
$pagingbar .= get_string($initial.'name').':&nbsp;';
if ($$var == 'all') {
$pagingbar .= '<strong>'.get_string('all').'</strong> ';
}
else {
- $pagingbar .= '<a href="'.$link.'">'.get_string('all').'</a> ';
+ $pagingbar .= "<a href=\"{$link}{$othervar}\">".get_string('all').'</a> ';
}
foreach ($alphabet as $letter) {
if ($$var === $letter) {
$pagingbar .= '<strong>'.$letter.'</strong> ';
}
else {
- $pagingbar .= '<a href="'.$link.'&amp;'.$var.'='.$letter.'">'.$letter.'</a> ';
+ $pagingbar .= "<a href=\"$link&amp;$var={$letter}{$othervar}\">$letter</a> ";
}
}
@@ -270,10 +273,15 @@ function csv_quote($value) {
$pagingbar .= '<div class="paging">';
$pagingbar .= get_string('page').': ';
+ $sistrings = array();
+ $sistrings[] = $sifirst != 'all' ? "sifirst={$sifirst}" : null;
+ $sistrings[] = $silast != 'all' ? "silast={$silast}" : null;
+ $sistring = !empty($sistrings) ? implode('&amp;', $sistrings) : '';
+
// Display previous link
if ($start > 0) {
$pstart = max($start - COMPLETION_REPORT_PAGE, 0);
- $pagingbar .= '(<a class="previous" href="'.$link.$pstart.'">'.get_string('previous').'</a>)&nbsp;';
+ $pagingbar .= "(<a class=\"previous\" href=\"{$link}{$pstart}{$sistring}\">".get_string('previous').'</a>)&nbsp;';
}
// Create page links
@@ -286,7 +294,7 @@ function csv_quote($value) {
$pagingbar .= '&nbsp;'.$curpage.'&nbsp;';
}
else {
- $pagingbar .= '&nbsp;<a href="'.$link.$curstart.'">'.$curpage.'</a>&nbsp;';
+ $pagingbar .= "&nbsp;<a href=\"{$link}{$curstart}{$sistring}\">$curpage</a>&nbsp;";
}
$curstart += COMPLETION_REPORT_PAGE;
@@ -295,7 +303,7 @@ function csv_quote($value) {
// Display next link
$nstart = $start + COMPLETION_REPORT_PAGE;
if ($nstart < $total) {
- $pagingbar .= '&nbsp;(<a class="next" href="'.$link.$nstart.'">'.get_string('next').'</a>)';
+ $pagingbar .= "&nbsp;(<a class=\"next\" href=\"{$link}{$nstart}{$sistring}\">".get_string('next').'</a>)';
}
$pagingbar .= '</div>';
@@ -441,12 +449,15 @@ function csv_quote($value) {
// User heading / sort option
print '<th scope="col" class="completion-sortchoice" style="clear: both;">';
+
+ $sistring = "&amp;silast={$silast}&amp;sifirst={$sifirst}";
+
if($firstnamesort) {
print
- get_string('firstname').' / <a href="./?course='.$course->id.'">'.
+ get_string('firstname')." / <a href=\"./?course={$course->id}{$sistring}\">".
get_string('lastname').'</a>';
} else {
- print '<a href="./?course='.$course->id.'&amp;sort=firstname">'.
+ print "<a href=\"./?course={$course->id}&amp;sort=firstname{$sistring}\">".
get_string('firstname').'</a> / '.
get_string('lastname');
}
View
25 course/report/progress/index.php
@@ -173,22 +173,25 @@ function csv_quote($value) {
foreach ($initials as $initial) {
$var = 'si'.$initial;
+ $othervar = $initial == 'first' ? 'silast' : 'sifirst';
+ $othervar = $$othervar != 'all' ? "&amp;{$othervar}={$$othervar}" : '';
+
$pagingbar .= ' <div class="initialbar '.$initial.'initial">';
$pagingbar .= get_string($initial.'name').':&nbsp;';
if ($$var == 'all') {
$pagingbar .= '<strong>'.get_string('all').'</strong> ';
}
else {
- $pagingbar .= '<a href="'.$link.'">'.get_string('all').'</a> ';
+ $pagingbar .= "<a href=\"{$link}{$othervar}\">".get_string('all').'</a> ';
}
foreach ($alphabet as $letter) {
if ($$var === $letter) {
$pagingbar .= '<strong>'.$letter.'</strong> ';
}
else {
- $pagingbar .= '<a href="'.$link.'&amp;'.$var.'='.$letter.'">'.$letter.'</a> ';
+ $pagingbar .= "<a href=\"$link&amp;$var={$letter}{$othervar}\">$letter</a> ";
}
}
@@ -202,10 +205,15 @@ function csv_quote($value) {
$pagingbar .= '<div class="paging">';
$pagingbar .= get_string('page').': ';
+ $sistrings = array();
+ $sistrings[] = $sifirst != 'all' ? "sifirst={$sifirst}" : null;
+ $sistrings[] = $silast != 'all' ? "silast={$silast}" : null;
+ $sistring = !empty($sistrings) ? implode('&amp;', $sistrings) : '';
+
// Display previous link
if ($start > 0) {
$pstart = max($start - COMPLETION_REPORT_PAGE, 0);
- $pagingbar .= '(<a class="previous" href="'.$link.$pstart.'">'.get_string('previous').'</a>)&nbsp;';
+ $pagingbar .= "(<a class=\"previous\" href=\"{$link}{$pstart}{$sistring}\">".get_string('previous').'</a>)&nbsp;';
}
// Create page links
@@ -218,7 +226,7 @@ function csv_quote($value) {
$pagingbar .= '&nbsp;'.$curpage.'&nbsp;';
}
else {
- $pagingbar .= '&nbsp;<a href="'.$link.$curstart.'">'.$curpage.'</a>&nbsp;';
+ $pagingbar .= "&nbsp;<a href=\"{$link}{$curstart}{$sistring}\">$curpage</a>&nbsp;";
}
$curstart += COMPLETION_REPORT_PAGE;
@@ -227,7 +235,7 @@ function csv_quote($value) {
// Display next link
$nstart = $start + COMPLETION_REPORT_PAGE;
if ($nstart < $total) {
- $pagingbar .= '&nbsp;(<a class="next" href="'.$link.$nstart.'">'.get_string('next').'</a>)';
+ $pagingbar .= "&nbsp;(<a class=\"next\" href=\"{$link}{$nstart}{$sistring}\">".get_string('next').'</a>)';
}
$pagingbar .= '</div>';
@@ -251,12 +259,15 @@ function csv_quote($value) {
// User heading / sort option
print '<th scope="col" class="completion-sortchoice">';
+
+ $sistring = "&amp;silast={$silast}&amp;sifirst={$sifirst}";
+
if($firstnamesort) {
print
- get_string('firstname').' / <a href="./?course='.$course->id.'">'.
+ get_string('firstname')." / <a href=\"./?course={$course->id}{$sistring}\">".
get_string('lastname').'</a>';
} else {
- print '<a href="./?course='.$course->id.'&amp;sort=firstname">'.
+ print "<a href=\"./?course={$course->id}&amp;sort=firstname{$sistring}\">".
get_string('firstname').'</a> / '.
get_string('lastname');
}

0 comments on commit 1f18637

Please sign in to comment.
Something went wrong with that request. Please try again.