version 1.5, 2012/04/04 21:04:56
|
version 1.9, 2013/01/04 05:45:50
|
Line 238 Output: None
|
Line 238 Output: None
|
|
|
Side Effects: prints web form elements (in a table) for current blocks. |
Side Effects: prints web form elements (in a table) for current blocks. |
|
|
=item &path_to_trigger() |
|
|
|
Provides hierarchy of names of folders/sub-folders containing the current |
|
item identified as an item with an interval timer set, to be used as a |
|
trigger. |
|
|
|
Inputs: 3 |
|
- $navmap - navmaps object |
|
|
|
- $map - url for map (either the trigger itself, or map containing |
|
the resource, which is the trigger). |
|
|
|
- $type - type of trigger: map or resource. |
|
|
|
Outputs: 1 @pathitems - array of folder/subfolder names. |
|
|
|
|
|
=item &convlim() |
=item &convlim() |
|
|
Convert a time interval used for a timed quiz (in seconds) to |
Convert a time interval used for a timed quiz (in seconds) to |
Line 506 sub handler {
|
Line 489 sub handler {
|
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/setblock', |
({href=>'/adm/setblock', |
text=>'Blocking communication/resource access'}); |
text=>'Blocking communication/content access'}); |
|
|
my $js = &blockingmenu_javascript($blockcount); |
my $js = &blockingmenu_javascript($blockcount); |
|
|
Line 515 sub handler {
|
Line 498 sub handler {
|
&Apache::lonhtmlcommon::breadcrumbs('Blocking communication/content access')); |
&Apache::lonhtmlcommon::breadcrumbs('Blocking communication/content access')); |
|
|
my $usertype; |
my $usertype; |
my $crstype = &Apache::loncommon::course_type(); |
|
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$usertype = 'members'; |
$usertype = 'members'; |
} else { |
} else { |
Line 565 sub handler {
|
Line 547 sub handler {
|
'<li>'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'</li>'."\n". |
'<li>'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'</li>'."\n". |
'<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n". |
'<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n". |
'<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n". |
'<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n". |
|
'<li>'.&mt("generating printouts of $lctype content").'</li>'. |
'<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'. |
'<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'. |
'</ul>'. |
'</ul>'. |
'<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>' |
'<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>' |
Line 1128 END
|
Line 1111 END
|
return; |
return; |
} |
} |
|
|
sub path_to_trigger { |
|
my ($navmap,$map,$type) = @_; |
|
my @pathitems; |
|
if (ref($navmap)) { |
|
my $mapres = $navmap->getResourceByUrl($map); |
|
if (ref($mapres)) { |
|
my $pcslist = $mapres->map_hierarchy(); |
|
if ($pcslist ne '') { |
|
my @pcs = split(/,/,$pcslist); |
|
foreach my $pc (@pcs) { |
|
if ($pc == 1) { |
|
push(@pathitems,&mt('Main Course Documents')); |
|
} else { |
|
my $res = $navmap->getByMapPc($pc); |
|
if (ref($res)) { |
|
my $title = $res->compTitle(); |
|
$title =~ s/\W+/_/g; |
|
if ($title ne '') { |
|
push(@pathitems,$title); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($type eq 'resource') { |
|
if ($mapres->{ID} eq '0.0') { |
|
push(@pathitems,&mt('Main Course Documents')); |
|
} else { |
|
my $maptitle = $mapres->compTitle(); |
|
$maptitle =~ s/\W+/_/g; |
|
if ($maptitle ne '') { |
|
push(@pathitems,$maptitle); |
|
} |
|
} |
|
} |
|
} |
|
return @pathitems; |
|
} |
|
|
|
sub convlim { |
sub convlim { |
my ($timelimit) = @_; |
my ($timelimit) = @_; |
my $output; |
|
my @order = ('days','hours','minutes','seconds'); |
my @order = ('days','hours','minutes','seconds'); |
my %catlimits = ( |
my %catlimits = ( |
days => 86400, |
days => 86400, |
Line 1180 sub convlim {
|
Line 1122 sub convlim {
|
my @toshow; |
my @toshow; |
foreach my $cat (@order) { |
foreach my $cat (@order) { |
if ($cat eq 'seconds') { |
if ($cat eq 'seconds') { |
last if ($timelimit <= 0); |
if ($timelimit > 0) { |
|
push(@toshow,&mt("[_1] $cat",$timelimit)); |
|
} |
} elsif ($timelimit >= $catlimits{$cat}) { |
} elsif ($timelimit >= $catlimits{$cat}) { |
my $val = int($timelimit/$catlimits{$cat}); |
my $val = int($timelimit/$catlimits{$cat}); |
if ($val > 0) { |
if ($val > 0) { |
push(@toshow,&mt("[_1] $cat",$val)); |
push(@toshow,&mt("[_1] $cat",$val)); |
} |
} |
$timelimit =- $val*$catlimits{$cat}; |
$timelimit -= $val*$catlimits{$cat}; |
} |
} |
} |
} |
my $output = join(', ',@toshow); |
my $output = join(', ',@toshow); |
Line 1457 sub show_timer_path {
|
Line 1401 sub show_timer_path {
|
return unless(ref($navmap)); |
return unless(ref($navmap)); |
my @pathitems; |
my @pathitems; |
if ($type eq 'map') { |
if ($type eq 'map') { |
@pathitems = &path_to_trigger($navmap,$item,$type); |
@pathitems = |
|
&Apache::loncommon::get_folder_hierarchy($navmap,$item); |
} elsif ($type eq 'resource') { |
} elsif ($type eq 'resource') { |
my ($map,$id,$resource) = &Apache::lonnet::decode_symb($item); |
my ($map,$id,$resource) = &Apache::lonnet::decode_symb($item); |
@pathitems = &path_to_trigger($navmap,$map,$type); |
@pathitems = |
|
&Apache::loncommon::get_folder_hierarchy($navmap,$map,1); |
} |
} |
if (@pathitems) { |
if (@pathitems) { |
return join(' » ',@pathitems); |
return join(' » ',@pathitems); |