version 1.1, 2016/04/02 04:30:21
|
version 1.4, 2016/04/14 15:43:45
|
Line 1
|
Line 1
|
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# Handler to manage dependencies for HTML files uploaded directly |
# Handler for a Placement Test course container |
# to a course. |
|
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 20
|
Line 19
|
# |
# |
# You should have received a copy of the GNU General Public License |
# You should have received a copy of the GNU General Public License |
# along with LON-CAPA; if not, write to the Free Software |
# along with LON-CAPA; if not, write to the Free Software |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA# |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
# |
# /home/httpd/html/adm/gpl.txt |
# /home/httpd/html/adm/gpl.txt |
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
Line 140 sub check_completion {
|
Line 140 sub check_completion {
|
if ($tries < $maxtries) { |
if ($tries < $maxtries) { |
$notdone ++; |
$notdone ++; |
my $tries = $res->tries($part); |
my $tries = $res->tries($part); |
my @response_ids = $res->responseIds($part); |
if ($makenew) { |
if (@response_ids) { |
my @response_ids = $res->responseIds($part); |
foreach my $id (@response_ids) { |
if (@response_ids) { |
$storetries{"resource.$part.$id.awarded"}=0; |
foreach my $id (@response_ids) { |
$storetries{"resource.$part.$id.awarddetail"}='ASSIGNED_SCORE'; |
$storetries{"resource.$part.$id.awarded"}=0; |
|
$storetries{"resource.$part.$id.awarddetail"}='ASSIGNED_SCORE'; |
|
} |
|
$storetries{"resource.$part.tries"}=$maxtries; |
|
$storetries{"resource.$part.solved"}='incorrect_by_override'; |
|
$storetries{"resource.$part.award"}='ASSIGNED_SCORE'; |
|
$storetries{"resource.$part.awarded"}=0; |
} |
} |
$storetries{"resource.$part.tries"}=$maxtries; |
|
$storetries{"resource.$part.solved"}='incorrect_by_override'; |
|
$storetries{"resource.$part.award"}='ASSIGNED_SCORE'; |
|
$storetries{"resource.$part.awarded"}=0; |
|
} |
} |
} else { |
} else { |
my $awarded = $res->awarded($part); |
my $awarded = $res->awarded($part); |
Line 203 sub check_completion {
|
Line 205 sub check_completion {
|
return ($totalpoints,$incomplete); |
return ($totalpoints,$incomplete); |
} |
} |
|
|
|
sub is_lastres { |
|
my ($symb,$navmap) = @_; |
|
return unless (ref($navmap)); |
|
my $numforward = 0; |
|
my $currRes = $navmap->getBySymb($symb); |
|
if (ref($currRes)) { |
|
my $it = $navmap->getIterator($currRes,undef,undef,1); |
|
while ( my $res=$it->next()) { |
|
if (ref($res)) { |
|
unless ($res->symb() eq $symb) { |
|
$numforward ++; |
|
} |
|
} |
|
} |
|
} |
|
if (!$numforward) { |
|
return 1; |
|
} |
|
return; |
|
} |
|
|
|
sub has_tries { |
|
my ($symb,$navmap) = @_; |
|
return unless (ref($navmap)); |
|
my $currRes = $navmap->getBySymb($symb); |
|
if (ref($currRes)) { |
|
if ($currRes->is_problem()) { |
|
if ($currRes->tries < $currRes->maxtries) { |
|
return 1; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
sub showresult { |
sub showresult { |
my ($complete) = @_; |
my ($complete,$inhibitmenu) = @_; |
my ($score) = &Apache::lonplacementtest::check_completion(1,undef,1); |
my ($score) = &Apache::lonplacementtest::check_completion(1,undef,1); |
my %aclt = &test_action_text(); |
my %aclt = &test_action_text(); |
my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a', |
my $output; |
'text' => 'Test Status'},]; |
if ($inhibitmenu) { |
my $output = &Apache::loncommon::start_page('Placement Test Completed', |
$output = '<hr />'; |
undef,{bread_crumbs=>$brcrum}); |
} else { |
|
my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a', |
|
'text' => 'Test Status'},]; |
|
$output = &Apache::loncommon::start_page('Placement Test Completed', |
|
undef,{bread_crumbs=>$brcrum}); |
|
} |
if ($complete) { |
if ($complete) { |
$output .= '<p class="LC_info">'.&mt('Test is complete').'</p>'; |
$output .= '<p class="LC_info">'.&mt('Test is complete').'</p>'; |
} |
} |
return $output |
$output .= '<p>'.&mt('You scored [quant,_1,point].',$score).'</p>' |
.'<p>'.&mt('You scored [quant,_1,point].',$score).'</p>' |
.&Apache::lonhtmlcommon::actionbox( |
.&Apache::lonhtmlcommon::actionbox( |
['<a href="/adm/flip?postdata=firstres%3a">'.$aclt{'newt'}.'</a></li>', |
['<a href="/adm/flip?postdata=firstres%3a">'.$aclt{'newt'}.'</a></li>', |
'<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>', |
'<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>', |
]); |
]) |
unless ($inhibitmenu) { |
.&Apache::loncommon::end_page(); |
$output .= &Apache::loncommon::end_page(); |
|
} |
|
return $output; |
} |
} |
|
|
sub showincomplete { |
sub showincomplete { |
my ($incomplete) = @_; |
my ($incomplete,$inhibitmenu) = @_; |
my %aclt = &test_action_text(); |
my %aclt = &test_action_text(); |
|
my $output; |
if ($incomplete == 100) { |
if ($incomplete == 100) { |
my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a', |
if ($inhibitmenu) { |
'text' => 'Test Status'},]; |
$output = '<hr />'; |
return &Apache::loncommon::start_page('Placement Test Unattempted', |
} else { |
undef,{bread_crumbs=>$brcrum}) |
my $brcrum = [{'href' => '/adm/flip?postdata=firstres%3a', |
.'<p class="LC_warning">'.&mt('Your Placement Test is incomplete.').'<p></p>' |
'text' => 'Test Status'},]; |
.&mt('Currently, you have not submitted any answers for any of the questions.') |
$output = &Apache::loncommon::start_page('Placement Test Unattempted', |
.'</p>' |
undef,{bread_crumbs=>$brcrum}); |
.&Apache::lonhtmlcommon::actionbox( |
} |
['<a href="/adm/flip?postdata=firstres%3a">'.$aclt{'begin'}.'</a></li>', |
$output .= '<p class="LC_warning">'.&mt('Your Placement Test is incomplete.').'<p></p>' |
'<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>', |
.&mt('Currently, you have not submitted any answers for any of the questions.') |
]) |
.'</p>' |
.&Apache::loncommon::end_page(); |
.&Apache::lonhtmlcommon::actionbox( |
|
['<a href="/adm/flip?postdata=firstres%3a">'.$aclt{'begin'}.'</a></li>', |
|
'<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>', |
|
]); |
} elsif ($incomplete) { |
} elsif ($incomplete) { |
my $brcrum = [{'href' => '/adm/flip?postdata=endplacement%3a', |
if ($inhibitmenu) { |
'text' => 'Test Status'},]; |
$output = '<hr />'; |
return &Apache::loncommon::start_page('Incomplete Placement Test', |
} else { |
undef,{bread_crumbs=>$brcrum}) |
my $brcrum = [{'href' => '/adm/flip?postdata=endplacement%3a', |
.'<p class="LC_warning">'.&mt('Your Placement Test is incomplete.').'<p></p>' |
'text' => 'Test Status'},]; |
.&mt('Currently, you have not provided an answer for [_1]% of the questions.',$incomplete) |
$output .= &Apache::loncommon::start_page('Incomplete Placement Test', |
.'</p>' |
undef,{bread_crumbs=>$brcrum}); |
.&Apache::lonhtmlcommon::actionbox( |
} |
['<a href="/adm/flip?postdata=endplacement%3a">'.$aclt{'endt'}.'</a></li>', |
$output .= '<p class="LC_warning">'.&mt('Your Placement Test is incomplete.').'<p></p>' |
'<a href="/adm/flip?postdata=firstanswerable%3a">'.$aclt{'comp'}.'</a></li>', |
.&mt('Currently, you have not provided an answer for [_1]% of the questions.',$incomplete) |
'<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>', |
.'</p>' |
]) |
.&Apache::lonhtmlcommon::actionbox( |
.&Apache::loncommon::end_page(); |
['<a href="/adm/flip?postdata=endplacement%3a">'.$aclt{'endt'}.'</a></li>', |
|
'<a href="/adm/flip?postdata=firstanswerable%3a">'.$aclt{'comp'}.'</a></li>', |
|
'<a href="/adm/logout">'.$aclt{'exit'}.'</a></li>', |
|
]); |
|
} |
|
unless ($inhibitmenu) { |
|
$output .= &Apache::loncommon::end_page(); |
} |
} |
|
return $output; |
} |
} |
|
|
sub test_action_text { |
sub test_action_text { |