version 1.12.2.2, 2009/12/07 04:48:04
|
version 1.12.2.8, 2010/02/26 23:39:01
|
Line 33 Apache::loncoursequeueadmin.pm
|
Line 33 Apache::loncoursequeueadmin.pm
|
|
|
=head1 SYNOPSIS |
=head1 SYNOPSIS |
|
|
Adminitsration utilities used by domain coordinators for queued course creation requests, and by course coordinators for queued self-enrollment requests. |
Utilities used by domain coordinators to administer queued course creation requests, |
|
and by course coordinators for queued self-enrollment requests, and by general |
|
users to display their queued self-enrollment requests. |
|
|
This is part of the LearningOnline Network with CAPA project |
This is part of the LearningOnline Network with CAPA project |
described at http://www.lon-capa.org. |
described at http://www.lon-capa.org. |
Line 50 described at http://www.lon-capa.org.
|
Line 52 described at http://www.lon-capa.org.
|
|
|
=item get_student_counts() |
=item get_student_counts() |
|
|
|
=item course_creation() |
|
|
|
=item build_batchcreatehash() |
|
|
|
=item can_clone_course() |
|
|
|
=item queued_selfenrollment() |
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 57 described at http://www.lon-capa.org.
|
Line 67 described at http://www.lon-capa.org.
|
package Apache::loncoursequeueadmin; |
package Apache::loncoursequeueadmin; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonmsg; |
use Apache::lonmsg; |
Line 457 sub update_request_queue {
|
Line 466 sub update_request_queue {
|
if ($uhome ne 'no_host') { |
if ($uhome ne 'no_host') { |
if (exists($requesthash{$uname.':'.$udom})) { |
if (exists($requesthash{$uname.':'.$udom})) { |
if ($cdom eq 'gci' && $cnum eq '9615072b469884921gcil1') { |
if ($cdom eq 'gci' && $cnum eq '9615072b469884921gcil1') { |
my $enresult = &enable_gci_submission($uname,$udom, |
my $enresult = &enable_gci_submission($udom,$uname, |
$access_start,$access_end); |
$access_end,$access_start); |
} |
} |
if (exists($classlist->{$uname.':'.$udom})) { |
if (exists($classlist->{$uname.':'.$udom})) { |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
Line 967 sub course_creation {
|
Line 976 sub course_creation {
|
} |
} |
my %reqdetails = &build_batchcreatehash($dom,$context,$details,$owneremail,$domdefs); |
my %reqdetails = &build_batchcreatehash($dom,$context,$details,$owneremail,$domdefs); |
my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses', |
my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses', |
\%reqdetails,$longroles,\$logmsg,\$newusermsg,\$addresult, |
\%reqdetails,$longroles,$logmsg,$newusermsg,$addresult, |
\$enrollcount,\$output,\$keysmsg,$ownerdom,$ownername,$cnum,$crstype); |
$enrollcount,$output,$keysmsg,$ownerdom,$ownername,$cnum,$crstype); |
if ($cid eq "/$dom/$cnum") { |
if ($cid eq "/$dom/$cnum") { |
$result = 'created'; |
$result = 'created'; |
} else { |
} else { |
Line 980 sub course_creation {
|
Line 989 sub course_creation {
|
sub build_batchcreatehash { |
sub build_batchcreatehash { |
my ($dom,$context,$details,$owneremail,$domdefs) = @_; |
my ($dom,$context,$details,$owneremail,$domdefs) = @_; |
my %batchhash; |
my %batchhash; |
my @items = qw{owner domain coursehome clonecrs clonedom datemode dateshift enrollstart enrollend accessstart accessend sections crosslists users}; |
my @items = qw{owner domain coursehome clonecrs clonedom cloneroster datemode dateshift enrollstart enrollend accessstart accessend sections crosslists users}; |
|
if ($dom eq 'gcitest') { |
|
push(@items,'firstres'); |
|
} |
if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) { |
if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) { |
my $emailenc = &Apache::lonnet::escape($owneremail); |
my $emailenc = &escape($owneremail); |
my $owner = $details->{'owner'}.':'.$details->{'domain'}; |
my $owner = $details->{'owner'}.':'.$details->{'domain'}; |
foreach my $item (@items) { |
foreach my $item (@items) { |
$batchhash{$item} = $details->{$item}; |
$batchhash{$item} = $details->{$item}; |
Line 1065 sub can_clone_course {
|
Line 1077 sub can_clone_course {
|
$canclone = 1; |
$canclone = 1; |
} |
} |
} |
} |
|
unless ($canclone) { |
|
if (&Apache::lonnet::is_course_owner($clonedom,$clonecrs,$uname,$udom)) { |
|
$canclone = 1; |
|
} |
|
} |
} |
} |
return $canclone; |
return $canclone; |
} |
} |
|
|
|
sub queued_selfenrollment { |
|
my ($notitle) = @_; |
|
my $output; |
|
my %selfenrollrequests = &Apache::lonnet::dump('selfenrollrequests'); |
|
my %reqs_by_date; |
|
foreach my $item (keys(%selfenrollrequests)) { |
|
if (ref($selfenrollrequests{$item}) eq 'HASH') { |
|
if ($selfenrollrequests{$item}{'status'} eq 'request') { |
|
if ($selfenrollrequests{$item}{'timestamp'}) { |
|
push(@{$reqs_by_date{$selfenrollrequests{$item}{'timestamp'}}},$item); |
|
} |
|
} |
|
} |
|
} |
|
if (keys(%reqs_by_date)) { |
|
unless ($notitle) { |
|
$output .= '<b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />'; |
|
} |
|
$output .= &Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row(). |
|
'<th>'.&mt('Date requested').'</th><th>'.&mt('Course title').'</th>'. |
|
'<th>'.&mt('User role').'</th><th>'.&mt('Section').'</th>'. |
|
&Apache::loncommon::end_data_table_header_row(); |
|
my @sorted = sort { $a <=> $b } (keys(%reqs_by_date)); |
|
foreach my $item (@sorted) { |
|
if (ref($reqs_by_date{$item}) eq 'ARRAY') { |
|
foreach my $crs (@{$reqs_by_date{$item}}) { |
|
my %courseinfo = &Apache::lonnet::coursedescription($crs); |
|
my $usec = $selfenrollrequests{$crs}{'section'}; |
|
my $rolename = &Apache::lonnet::plaintext('st',$courseinfo{'type'},$crs); |
|
if ($usec eq '') { |
|
$usec = &mt('No section'); |
|
} |
|
$output .= &Apache::loncommon::start_data_table_row(). |
|
'<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'. |
|
'<td>'.$courseinfo{'description'}.'</td>'. |
|
'<td>'.$rolename.'</td><td>'.$usec.'</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
|
} |
|
} |
|
$output .= &Apache::loncommon::end_data_table(); |
|
} |
|
return $output; |
|
} |
|
|
1; |
1; |