version 1.141, 2002/11/15 18:59:28
|
version 1.142, 2002/11/19 19:20:50
|
Line 1186 sub get_row {
|
Line 1186 sub get_row {
|
######################################################################## |
######################################################################## |
sub sort_indicies { |
sub sort_indicies { |
my $sheet = shift; |
my $sheet = shift; |
# |
|
# Sort the rows in some manner |
|
# |
|
my @sortby=(); |
|
my @sortidx=(); |
my @sortidx=(); |
# Skip row 0 |
# |
for (my $row=1;$row<=$sheet->{'maxrow'};$row++) { |
if ($sheet->{'sheettype'} eq 'classcalc') { |
push (@sortby, $sheet->{'safe'}->reval('$f{"A'.$row.'"}')); |
my @sortby=(); |
push (@sortidx, $row); |
# Skip row 0 |
|
for (my $row=1;$row<=$sheet->{'maxrow'};$row++) { |
|
my (undef,$sname,$sdom,$fullname,$section,$id) = |
|
split(':',$sheet->{'rowlabel'}->{$sheet->{'f'}->{'A'.$row}}); |
|
push (@sortby, lc($fullname)); |
|
push (@sortidx, $row); |
|
} |
|
@sortidx = sort { $sortby[$a] cmp $sortby[$b]; } @sortidx; |
|
} elsif ($sheet->{'sheettype'} eq 'studentcalc') { |
|
my @sortby=(); |
|
# Skip row 0 |
|
&Apache::lonnet::logthis('starting sort for studentcalc'); |
|
for (my $row=1;$row<=$sheet->{'maxrow'};$row++) { |
|
my (undef,$symb,$uname,$udom,$mapid,$resid,$title) = |
|
split(':',$sheet->{'rowlabel'}->{$sheet->{'f'}->{'A'.$row}}); |
|
$symb = &Apache::lonnet::unescape($symb); |
|
my ($sequence) = ($symb =~ /\/([^\/]*\.sequence)/); |
|
if ($sequence eq '') { |
|
$sequence = $symb; |
|
} |
|
push (@sortby, $sequence); |
|
push (@sortidx, $row); |
|
} |
|
@sortidx = sort { $sortby[$a] cmp $sortby[$b]; } @sortidx; |
|
} else { |
|
my @sortby=(); |
|
# Skip row 0 |
|
for (my $row=1;$row<=$sheet->{'maxrow'};$row++) { |
|
push (@sortby, $sheet->{'safe'}->reval('$f{"A'.$row.'"}')); |
|
push (@sortidx, $row); |
|
} |
|
@sortidx = sort { $sortby[$a] cmp $sortby[$b]; } @sortidx; |
} |
} |
@sortidx=sort { lc($sortby[$a]) cmp lc($sortby[$b]); } @sortidx; |
|
return @sortidx; |
return @sortidx; |
} |
} |
|
|