version 1.52, 2002/08/30 20:41:09
|
version 1.55, 2002/09/05 19:35:00
|
Line 43 use strict;
|
Line 43 use strict;
|
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::loncommon; |
use Apache::inputtags; |
use Apache::inputtags; |
|
use Apache::loncoursedata; |
|
use Apache::grades; |
use Apache::edit; |
use Apache::edit; |
use Apache::File(); |
use Apache::File(); |
use POSIX qw(strftime); |
use POSIX qw(strftime); |
use Apache::loncoursedata; |
|
|
|
|
|
sub headerform { |
sub headerform { |
Line 83 ENDMENUOUT2
|
Line 85 ENDMENUOUT2
|
} |
} |
if ($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) { |
if ($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) { |
$r->print(<<ENDMENUOUT6); |
$r->print(<<ENDMENUOUT6); |
<input type="radio" name="choice" value="All class print"> Print assignment for students in class<br /> |
<input type="radio" name="choice" value="All class print"> Print assignment (all problems from the primary sequence) for group of students<br /><br /> |
ENDMENUOUT6 |
ENDMENUOUT6 |
} |
} |
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
Line 135 sub additional_class_menu {
|
Line 137 sub additional_class_menu {
|
ENDMENUOUT1 |
ENDMENUOUT1 |
my $c = $r->connection; |
my $c = $r->connection; |
my %cache; |
my %cache; |
my $courseID=$ENV{'request.course.id'}; |
my $courseID = $ENV{'request.course.id'}; |
my $classlist=&Apache::loncoursedata::DownloadClasslist($courseID, |
my $classlist = &Apache::loncoursedata::DownloadClasslist($courseID,$cache{'ClasslistTimestamp'},$c); |
$cache{'ClasslistTimestamp'}, |
&Apache::loncoursedata::ProcessClasslist(\%cache,$classlist,$courseID,$c); |
$c); |
my @all_students = split(':::',$cache{'NamesOfStudents'}); |
foreach (keys(%$classlist)) { |
my @active_students = (); |
if(/^(con_lost|error|no_such_host)/i) { |
foreach my $student (@all_students) { |
untie(%cache); |
if ($cache{$student.':Status'} eq 'Active') { |
return "Error getting student data."; |
push @active_students,$student; |
} |
} |
} |
} |
my $classlistaa = ''; |
my $what_to_print = '<table border="1">'; |
foreach my $st (keys(%$classlist)) { |
my $i = 0; |
$classlistaa .= ' SSS '.$st.' => '.$$classlist{$st}.' FFF '."\r\n"; |
foreach my $student (@active_students) { |
|
$what_to_print .= '<tr><td><input type="checkbox" name="whomtoprint'.$i.'" value="'.$student.'">'.$cache{$student.':fullname'}.'</td></tr>'; |
|
# $what_to_print .= '<tr><td><input type="checkbox" name="whomtoprint'.$i.'" value="'.$cache{$student.':fullname'}.'">'.$cache{$student.':fullname'}.'</td></tr>'; |
|
$i++; |
} |
} |
|
$what_to_print .= '</table>'; |
$r->print(<<ENDMENUOUT2); |
$r->print(<<ENDMENUOUT2); |
$classlistaa <br /> |
$what_to_print <br /> |
|
<input type="hidden" name="numberofstudents" value="$i"> |
<input type="hidden" name="phase" value="three"> |
<input type="hidden" name="phase" value="three"> |
<input type="submit" value="Submit"> |
<input type="submit" value="Submit"> |
ENDMENUOUT2 |
ENDMENUOUT2 |
Line 160 ENDMENUOUT2
|
Line 166 ENDMENUOUT2
|
|
|
sub additional_print_menu { |
sub additional_print_menu { |
my $r = shift; |
my $r = shift; |
|
my $what_to_print = ''; |
|
for (my $i=0; $i<$ENV{'form.numberofstudents'};$i++) { |
|
$what_to_print .= '<input type="hidden" name="whomtoprint'.$i.'" value="'.$ENV{'form.whomtoprint'.$i}.'">'; |
|
} |
$r->print(<<ENDMENUOUT); |
$r->print(<<ENDMENUOUT); |
|
$what_to_print |
<input type="hidden" name="url" value="$ENV{'form.url'}"> |
<input type="hidden" name="url" value="$ENV{'form.url'}"> |
<input type="hidden" name="choice" value="$ENV{'form.choice'}"> |
<input type="hidden" name="choice" value="$ENV{'form.choice'}"> |
<input type="hidden" name="layout" value="$ENV{'form.layout'}"> |
<input type="hidden" name="layout" value="$ENV{'form.layout'}"> |
|
<input type="hidden" name="numberofstudents" value="$ENV{'form.numberofstudents'}"> |
<input type="hidden" name="numberofcolumns" value="$ENV{'form.numberofcolumns'}"> |
<input type="hidden" name="numberofcolumns" value="$ENV{'form.numberofcolumns'}"> |
Enter width of the page: <input type="text" name="width" width="10" value="9cm"> <br /> |
Enter width of the page: <input type="text" name="width" width="10" value="9cm"> <br /> |
<input type="hidden" name="phase" value="four"> |
<input type="hidden" name="phase" value="four"> |
Line 236 ENDPART
|
Line 248 ENDPART
|
&Apache::lonnet::delenv('form.grade_target'); |
&Apache::lonnet::delenv('form.grade_target'); |
$result .= $texversion; |
$result .= $texversion; |
} |
} |
} else { |
} elsif ($urlp =~ /\S+/) { |
my %moreenv; |
my %moreenv; |
$moreenv{'form.grade_target'}='tex'; |
$moreenv{'form.grade_target'}='tex'; |
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::appenv(%moreenv); |
Line 309 ENDPART
|
Line 321 ENDPART
|
} |
} |
$result = &additional_cleanup($result); |
$result = &additional_cleanup($result); |
} elsif ($choice eq 'All class print') { |
} elsif ($choice eq 'All class print') { |
|
#-- prints assignments for whole class or for selected students |
|
my (@students,@st_output) = ((),()); |
|
for (my $i=0; $i<$ENV{'form.numberofstudents'};$i++) { |
|
if ($ENV{'form.whomtoprint'.$i}=~/:/) { |
|
push @students,$ENV{'form.whomtoprint'.$i}; |
|
} |
|
} |
|
#where is the primary sequence containing current resource (the same for all students)? |
|
my $symbolic = &Apache::lonnet::symbread($ENV{'form.url'}); |
|
$symbolic =~ m/([^_]+)_/; |
|
my $primary_sequence = '/res/'.$1; |
|
#opens and analyses the primary sequence file, produces the array of resources |
|
my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence); |
|
my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file); |
|
my @master_seq = &content_map($sequencefilecontents); |
|
#loop over students |
|
foreach my $person (@students) { |
|
my $current_output = ''; |
|
my ($username,$userdomain) = split /:/,$person; |
|
my $fullname = &Apache::grades::get_fullname($username,$userdomain); |
|
#goes through all resources, checks if they are available for current student, and produces output |
|
foreach my $curres (@master_seq) { |
|
$curres =~ s/^"//; |
|
$curres =~ s/"$//; |
|
if ($curres=~/\w+/) { |
|
my $symb = &Apache::lonnet::symbread($curres); |
|
my ($map,$id,$res_url) = split(/___/,$symb); |
|
if (&Apache::lonnet::allowed('bre',$res_url)) { |
|
my $rendered = &Apache::loncommon::get_student_view($symb,$username,$userdomain, |
|
$ENV{'request.course.id'},'tex'); |
|
$current_output .= $rendered; |
|
} |
|
} |
|
} |
|
$current_output =~ s/\\begin{document}/\\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$fullname}}\\hskip 1\.4in } \\vskip 5 mm /; |
|
$result .= $current_output; |
|
} |
|
|
|
$result = &additional_cleanup($result); |
|
|
|
|
|
|
|
|
|
|
|
|