version 1.1, 2004/07/19 17:57:25
|
version 1.6, 2006/03/15 19:41:26
|
Line 36 use Apache::loncommon();
|
Line 36 use Apache::loncommon();
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::Constants qw(:common :http REDIRECT); |
use Apache::Constants qw(:common :http REDIRECT); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
|
|
|
|
################################################################### |
################################################################### |
Line 67 sub handler {
|
Line 68 sub handler {
|
text=>"View Classlist", |
text=>"View Classlist", |
faq=>9,bug=>'Instructor Interface',}); |
faq=>9,bug=>'Instructor Interface',}); |
# Needs to be in a course |
# Needs to be in a course |
if (! ($ENV{'request.course.fn'})) { |
if (! ($env{'request.course.fn'})) { |
$ENV{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/viewclasslist:not in course role"; |
"/adm/viewclasslist:not in course role"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
# |
# |
my $bodytag=&Apache::loncommon::bodytag('Classlist'); |
my $start = &Apache::loncommon::start_page('Classlist'); |
my $breadcrumbs=&Apache::lonhtmlcommon::breadcrumbs(undef, |
my $breadcrumbs= &Apache::lonhtmlcommon::breadcrumbs(undef, |
'Enrollment Manager'); |
'Enrollment Manager'); |
|
|
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
<html> |
$start_page |
<head> |
|
<title>Classlist</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
ENDHEADER |
ENDHEADER |
|
|
# |
# |
# Print classlist |
# Print classlist |
my $cid = $ENV{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
my $viewpermission = 'course.'.$cid.'.student_classlist_view'; |
my $viewpermission = 'course.'.$cid.'.student_classlist_view'; |
if (&allowed_to_view_classlist()) { |
if (&allowed_to_view_classlist()) { |
$r->print(&html_classlist()); |
$r->print(&html_classlist()); |
Line 101 ENDHEADER
|
Line 96 ENDHEADER
|
} |
} |
# |
# |
# Finish up |
# Finish up |
$r->print('</body></html>'); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
sub allowed_to_view_classlist { |
sub allowed_to_view_classlist { |
return 0 if (! exists($ENV{'request.course.id'})); |
return 0 if (! exists($env{'request.course.id'})); |
my $cid = $ENV{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
my $viewpermission = 'course.'.$cid.'.student_classlist_view'; |
my $viewpermission = 'course.'.$cid.'.student_classlist_view'; |
if (exists($ENV{$viewpermission}) && |
if (exists($env{$viewpermission}) && |
$ENV{$viewpermission} =~ /^(all|section)$/) { |
$env{$viewpermission} =~ /^(all|section)$/) { |
return $ENV{$viewpermission}; |
return $env{$viewpermission}; |
} else { |
} else { |
return 0; |
return 0; |
} |
} |
|
|
} |
} |
|
|
sub html_classlist { |
sub html_classlist { |
my $limit_to_section = (&allowed_to_view_classlist()=~ /^section$/i); |
my $limit_to_section = (&allowed_to_view_classlist()=~ /^section$/i); |
my $Str; |
my $Str; |
if ($limit_to_section) { |
if ($limit_to_section) { |
if ($ENV{'request.course.sec'} eq '') { |
if ($env{'request.course.sec'} eq '') { |
$Str .= '<h2>'. |
$Str .= '<h2>'. |
&mt('Students with no section').'</h2>'; |
&mt('Students with no section').'</h2>'; |
} else { |
} else { |
$Str.='<h2>'. |
$Str.='<h2>'. |
&mt('Students in section "[_1]"', |
&mt('Students in section "[_1]"', |
$ENV{'request.course.sec'}). |
$env{'request.course.sec'}). |
'</h2>'; |
'</h2>'; |
} |
} |
} |
} |
Line 166 sub html_classlist {
|
Line 160 sub html_classlist {
|
} |
} |
my $section = $classlist->{$student}->[$sectionidx]; |
my $section = $classlist->{$student}->[$sectionidx]; |
my $status = $classlist->{$student}->[$statusidx]; |
my $status = $classlist->{$student}->[$statusidx]; |
# next if (lc($status) ne 'active'); |
next if (lc($status) ne 'active'); |
if ($limit_to_section) { |
if ($limit_to_section) { |
if ($section ne $ENV{'request.course.sec'}) { |
if ($section ne $env{'request.course.sec'}) { |
next; |
next; |
} |
} |
} |
} |
|
|
$Str .= '<tr>'. |
$Str .= '<tr>'. |
'<td>'.$count++.'</td>'. |
'<td>'.$count++.'</td>'. |
'<td>'.&Apache::loncommon::aboutmewrapper($fullname, |
'<td>'.&Apache::loncommon::aboutmewrapper($fullname, |
Line 180 sub html_classlist {
|
Line 173 sub html_classlist {
|
$domain).'</td>'. |
$domain).'</td>'. |
'<td>'.(' 'x2). |
'<td>'.(' 'x2). |
&Apache::loncommon::messagewrapper |
&Apache::loncommon::messagewrapper |
('<img src="/adm/lonIcons/mailto.gif" /> '. |
('<img src="/adm/lonIcons/mailto.gif" border="0" /> '. |
$username.'@'.$domain,$username,$domain).'</td>'; |
$username.'@'.$domain,$username,$domain).'</td>'; |
if (! $limit_to_section) { |
if (! $limit_to_section) { |
$Str .= '<td>'.$section.'</td>'; |
$Str .= '<td>'.$section.'</td>'; |