| … | |
… | |
| 52 | |
52 | |
| 53 | sub body { |
53 | sub body { |
| 54 | my $self = shift; |
54 | my $self = shift; |
| 55 | my $r = $self->{r}; |
55 | my $r = $self->{r}; |
| 56 | my $courseEnvironment = $self->{courseEnvironment}; |
56 | my $courseEnvironment = $self->{courseEnvironment}; |
| 57 | my $user = $r->param('user'); |
57 | my $user = $r->param("user"); |
|
|
58 | my $sort = $r->param("sort"); |
| 58 | my $wwdb = $self->{wwdb}; |
59 | my $wwdb = $self->{wwdb}; |
|
|
60 | |
|
|
61 | $sort = "status" unless $sort eq "status" or $sort eq "name"; |
|
|
62 | my $baseURL = $r->uri . "?" . $self->url_authen_args(); |
|
|
63 | my $nameHeader = ($sort eq "name") ? "Name" : CGI::a({-href=>"$baseURL&sort=name"}, "Name"); |
|
|
64 | my $statusHeader = ($sort eq "status") ? "Status" : CGI::a({-href=>"$baseURL&sort=status"}, "Status"); |
| 59 | |
65 | |
| 60 | print CGI::startform(-method=>"POST", -action=>$r->uri."hardcopy/"); |
66 | print CGI::startform(-method=>"POST", -action=>$r->uri."hardcopy/"); |
| 61 | print $self->hidden_authen_fields; |
67 | print $self->hidden_authen_fields; |
| 62 | print CGI::start_table(); |
68 | print CGI::start_table(); |
| 63 | print CGI::Tr( |
69 | print CGI::Tr( |
| 64 | CGI::th("Sel."), |
70 | CGI::th("Sel."), |
| 65 | CGI::th("Name"), |
71 | CGI::th($nameHeader), |
| 66 | CGI::th("Status"), |
72 | CGI::th($statusHeader), |
| 67 | CGI::th("Hardcopy"), |
73 | CGI::th("Hardcopy"), |
| 68 | ); |
74 | ); |
| 69 | |
75 | |
| 70 | my @sets; |
76 | my @sets; |
| 71 | push @sets, $wwdb->getSet($user, $_) foreach ($wwdb->getSets($user)); |
77 | push @sets, $wwdb->getSet($user, $_) foreach ($wwdb->getSets($user)); |
| 72 | foreach my $set (sort { $a->open_date <=> $b->open_date } @sets) { |
78 | @sets = sort byname @sets if $sort eq "name"; |
|
|
79 | @sets = sort byduedate @sets if $sort eq "status"; |
|
|
80 | foreach my $set (@sets) { |
| 73 | print $self->setListRow($set); |
81 | print $self->setListRow($set); |
| 74 | } |
82 | } |
| 75 | |
83 | |
| 76 | print CGI::end_table(); |
84 | print CGI::end_table(); |
| 77 | print CGI::p(CGI::submit("hardcopy", "Download Harcopy for Selected Sets")); |
85 | print CGI::p(CGI::submit("hardcopy", "Download Harcopy for Selected Sets")); |
| … | |
… | |
| 131 | $status, |
139 | $status, |
| 132 | $hardcopy, |
140 | $hardcopy, |
| 133 | ])); |
141 | ])); |
| 134 | } |
142 | } |
| 135 | |
143 | |
|
|
144 | sub byname { $a->id cmp $b->id; } |
|
|
145 | sub byduedate { $a->due_date <=> $b->due_date; } |
|
|
146 | |
| 136 | 1; |
147 | 1; |