Permalink
Browse files

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

…roken
  • Loading branch information...
tlevi authored and sammarshallou committed Aug 16, 2011
1 parent 75371a7 commit cc6b535972a61fe79ff734c886e9187c3307f2e9
Showing with 36 additions and 14 deletions.
  1. +18 −7 course/report/completion/index.php
  2. +18 −7 course/report/progress/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');
}
@@ -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 cc6b535

Please sign in to comment.