version 1.1, 2004/07/19 17:57:25
|
version 1.5, 2005/04/07 06:56:23
|
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; |
} |
} |
Line 78 sub handler {
|
Line 79 sub handler {
|
my $bodytag=&Apache::loncommon::bodytag('Classlist'); |
my $bodytag=&Apache::loncommon::bodytag('Classlist'); |
my $breadcrumbs=&Apache::lonhtmlcommon::breadcrumbs(undef, |
my $breadcrumbs=&Apache::lonhtmlcommon::breadcrumbs(undef, |
'Enrollment Manager'); |
'Enrollment Manager'); |
|
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
<html> |
$html |
<head> |
<head> |
<title>Classlist</title> |
<title>Classlist</title> |
</head> |
</head> |
$bodytag |
$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 106 ENDHEADER
|
Line 106 ENDHEADER
|
} |
} |
|
|
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 165 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 178 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>'; |