version 1.15, 2013/07/15 17:00:19
|
version 1.16, 2014/10/26 15:20:25
|
Line 87 ENDHEADER
|
Line 87 ENDHEADER
|
|
|
# Get classlist view settings |
# Get classlist view settings |
my %viewsettings = &retrieve_view_settings(); |
my %viewsettings = &retrieve_view_settings(); |
|
my $crstype = &Apache::loncommon::course_type(); |
|
|
if (($env{'form.forceedit'}) || ($env{'form.action'} eq 'setconfig')) { |
if (($env{'form.forceedit'}) || ($env{'form.action'} eq 'setconfig')) { |
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
my $crstype = &Apache::loncommon::course_type(); |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $rosterprefs = &roster_prefs($crstype); |
my $rosterprefs = &roster_prefs($crstype); |
Line 157 ENDHEADER
|
Line 157 ENDHEADER
|
'<input type="submit" value="'.&mt('Save').'" />'. |
'<input type="submit" value="'.&mt('Save').'" />'. |
'</form>'); |
'</form>'); |
} else { |
} else { |
$r->print('<div class="LC_info">'. |
$r->print('<div class="LC_info">'); |
&mt('No student-viewable course roster settings available.'). |
if ($crstype eq 'Community') { |
'</div>'); |
$r->print(&mt('No member-viewable community roster settings available.')); |
|
} else { |
|
$r->print(&mt('No student-viewable course roster settings available.')); |
|
} |
|
$r->print('</div>'); |
} |
} |
} |
} |
} else { |
} else { |
$r->print('<div class="LC_info">'. |
$r->print('<div class="LC_info">'); |
&mt('You do not have rights to modify student-viewable course roster settings.'). |
if ($crstype eq 'Community') { |
'</div>'); |
$r->print(&mt('You do not have rights to modify member-viewable community roster settings.')); |
|
} else { |
|
$r->print(&mt('You do not have rights to modify student-viewable course roster settings.')); |
|
} |
|
$r->print('</div>'); |
} |
} |
} else { |
} else { |
|
|
# Print classlist |
# Print classlist |
if (keys(%viewsettings) > 0) { |
if (keys(%viewsettings) > 0) { |
$r->print(&html_classlist($r,\%viewsettings)); |
$r->print(&html_classlist($r,$crstype,\%viewsettings)); |
} else { |
} else { |
$r->print('<div class="LC_info">'. |
$r->print('<div class="LC_info">'); |
&mt("Display of a student-viewable course roster is not currently enabled."). |
if ($crstype eq 'Community') { |
'</div>'); |
$r->print(&mt("Display of a member-viewable community roster is not currently enabled.")); |
|
} else { |
|
$r->print(&mt("Display of a student-viewable course roster is not currently enabled.")); |
|
} |
|
$r->print('</div>'); |
} |
} |
} |
} |
# |
# |
Line 211 sub roster_prefs {
|
Line 223 sub roster_prefs {
|
my %lt; |
my %lt; |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
%lt = &Apache::lonlocal::texthash ( |
%lt = &Apache::lonlocal::texthash ( |
|
svrs => 'Member-viewable roster settings', |
stuv => 'Member-viewable membership list options', |
stuv => 'Member-viewable membership list options', |
stul => 'Member agreement needed to be listed', |
stul => 'Member agreement needed to be listed', |
); |
); |
} else { |
} else { |
%lt = &Apache::lonlocal::texthash( |
%lt = &Apache::lonlocal::texthash( |
|
svrs => 'Student-viewable roster settings', |
stuv => 'Student-viewable classlist options', |
stuv => 'Student-viewable classlist options', |
stul => 'Student agreement needed to be listed', |
stul => 'Student agreement needed to be listed', |
); |
); |
Line 223 sub roster_prefs {
|
Line 237 sub roster_prefs {
|
$lt{'incl'} = &mt('Include link to accessible portfolio files'); |
$lt{'incl'} = &mt('Include link to accessible portfolio files'); |
|
|
return |
return |
{ text => 'Student-viewable roster settings', |
{ text => $lt{'svrs'}, |
header => [ {col1 => 'Setting', |
header => [ {col1 => 'Setting', |
col2 => $lt{'stuv'}}], |
col2 => $lt{'stuv'}}], |
ordered => ['student_classlist_view', |
ordered => ['student_classlist_view', |
Line 238 sub roster_prefs {
|
Line 252 sub roster_prefs {
|
} |
} |
|
|
sub html_classlist { |
sub html_classlist { |
my ($r,$viewsettings) = @_; |
my ($r,$crstype,$viewsettings) = @_; |
my ($Str,$title,$secdisplay,$cid,$cdom,$cnum,$listtype,%publicroster); |
my ($Str,$title,$secdisplay,$cid,$cdom,$cnum,$listtype,%publicroster); |
my $fullroster = &Apache::loncoursedata::get_classlist(); |
my $fullroster = &Apache::loncoursedata::get_classlist(); |
my $classlist; |
my $classlist; |
|
|
|
my $singular = 'student'; |
|
my $plural = 'students'; |
|
my $titleplural = 'Students'; |
|
my $heading = &mt('Student-viewable course roster'); |
|
|
|
if ($crstype eq 'Community') { |
|
$singular = 'member'; |
|
$plural = 'members'; |
|
$titleplural = 'Members'; |
|
$heading = &mt('Member-viewable community roster'); |
|
} |
|
|
if ($env{'form.action'} eq 'setenv') { |
if ($env{'form.action'} eq 'setenv') { |
$Str .= &process_student_prefs(); |
$Str .= &process_student_prefs(); |
} |
} |
$Str .= '<h2>'.&mt('Student-viewable course roster').'</h2>'; |
|
|
$Str .= '<h2>'.$heading.'</h2>'; |
|
|
$cid = $env{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
$cdom = $env{'course.'.$cid.'.domain'}; |
$cdom = $env{'course.'.$cid.'.domain'}; |
$cnum = $env{'course.'.$cid.'.num'}; |
$cnum = $env{'course.'.$cid.'.num'}; |
|
|
|
my $title; |
if ($viewsettings->{'limit_to_section'}) { |
if ($viewsettings->{'limit_to_section'}) { |
if ($env{'request.course.sec'} eq '') { |
if ($env{'request.course.sec'} eq '') { |
$title = '<h3>'.&mt('Students with no section').'</h3>'; |
$title = &mt($titleplural.' with no section'); |
$listtype = 'without a section'; |
$listtype = 'without a section'; |
} else { |
} else { |
$title ='<h3>'.&mt('Students in section "[_1]"', |
$title = &mt($titleplural.' in section "[_1]"', |
$env{'request.course.sec'}).'</h3>'; |
$env{'request.course.sec'}); |
$listtype = 'in the section'; |
$listtype = 'in the section'; |
$secdisplay = " ($env{'request.course.sec'}) "; |
$secdisplay = " ($env{'request.course.sec'}) "; |
} |
} |
} else { |
} else { |
$title .= '<h3>'.&mt('Students in any section').'</h3>'; |
$title = &mt($titleplural.' in any section'); |
$listtype = 'in the course'; |
$listtype = 'in the course'; |
} |
} |
|
|
Line 274 sub html_classlist {
|
Line 302 sub html_classlist {
|
%publicroster = &Apache::lonnet::dump('publicroster',$cdom,$cnum); |
%publicroster = &Apache::lonnet::dump('publicroster',$cdom,$cnum); |
} |
} |
|
|
$Str .= $title; |
$Str .= '<h3>'.$title.'</h3>'; |
|
|
my $fullcount = 0; |
my $fullcount = 0; |
my $publiccount = 0; |
my $publiccount = 0; |
Line 303 sub html_classlist {
|
Line 331 sub html_classlist {
|
$displaycount = $publiccount; |
$displaycount = $publiccount; |
if ($fullcount > $publiccount) { |
if ($fullcount > $publiccount) { |
if ($publiccount) { |
if ($publiccount) { |
$Str .= &mt('Only students who have opted to be listed in the roster ([_1] out of [_2] students) are shown.',$publiccount,$fullcount).'<br />'; |
$Str .= &mt('Only '.$plural.' who have opted to be listed in the roster ([_1] out of [_2] '.$plural.') are shown.',$publiccount,$fullcount).'<br />'; |
} else { |
} else { |
if ($fullcount == 1) { |
if ($fullcount == 1) { |
$Str .= &mt('The single student '.$listtype.'[_1] has opted not to be listed in the roster.',$secdisplay); |
$Str .= &mt('The single '.$singular.' '.$listtype.'[_1] has opted not to be listed in the roster.',$secdisplay); |
} else { |
} else { |
$Str .= &mt('None of the [_1] students '.$listtype.'[_2] have opted to be listed in the roster.',$fullcount,$secdisplay); |
$Str .= &mt('None of the [_1] '.$plural.' '.$listtype.'[_2] have opted to be listed in the roster.',$fullcount,$secdisplay); |
} |
} |
return $Str; |
return $Str; |
} |
} |
} else { |
} else { |
if ($fullcount > 1) { |
if ($fullcount > 1) { |
$Str .= &mt('All [_1] students '.$listtype.'[_2] have opted to be listed in the roster.',$fullcount,$secdisplay); |
$Str .= &mt('All [_1] '.$plural.' '.$listtype.'[_2] have opted to be listed in the roster.',$fullcount,$secdisplay); |
} elsif ($fullcount == 1) { |
} elsif ($fullcount == 1) { |
$Str .= &mt('The single student '.$listtype.'[_1] has opted to be listed in the roster.',$secdisplay); |
$Str .= &mt('The single '.$singular.' '.$listtype.'[_1] has opted to be listed in the roster.',$secdisplay); |
} |
} |
} |
} |
} else { |
} else { |
$displaycount = $fullcount; |
$displaycount = $fullcount; |
if ($fullcount > 1) { |
if ($fullcount > 1) { |
$Str .= &mt('All [_1] students '.$listtype.'[_2] are listed in the roster.',$fullcount,$secdisplay); |
$Str .= &mt('All [_1] '.$plural.' '.$listtype.'[_2] are listed in the roster.',$fullcount,$secdisplay); |
} elsif ($fullcount == 1) { |
} elsif ($fullcount == 1) { |
$Str .= &mt('There is only a single student '.$listtype.'[_1]',$secdisplay); |
$Str .= &mt('There is only a single '.$singular.' '.$listtype.'[_1]',$secdisplay); |
} |
} |
} |
} |
undef($fullroster); |
undef($fullroster); |
|
|
if (!$displaycount) { |
if (!$displaycount) { |
$Str .= &mt('There are currently no students to display.'); |
$Str .= &mt('There are currently no '.$plural.' to display.'); |
return $Str; |
return $Str; |
} |
} |
|
|
Line 347 sub html_classlist {
|
Line 375 sub html_classlist {
|
$Str .= '<br />'.&Apache::loncommon::start_data_table()."\n". |
$Str .= '<br />'.&Apache::loncommon::start_data_table()."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
'<th></th>'. # for the count |
'<th></th>'. # for the count |
'<th>'.&mt('Student').'</th>'. |
'<th>'.&mt('Name').'</th>'. |
'<th>'.&mt('Username').'</th>'; |
'<th>'.&mt('Username').'</th>'; |
if (! $viewsettings->{'limit_to_section'}) { |
if (! $viewsettings->{'limit_to_section'}) { |
$Str .= '<th>'.&mt('Section').'</th>'; |
$Str .= '<th>'.&mt('Section').'</th>'; |