version 1.70, 2003/04/21 15:12:37
|
version 1.75, 2003/06/02 17:18:33
|
Line 109 sub get_sequence_assessment_data {
|
Line 109 sub get_sequence_assessment_data {
|
if (!defined($navmap)) { |
if (!defined($navmap)) { |
return 'Can not open Coursemap'; |
return 'Can not open Coursemap'; |
} |
} |
|
# We explicity grab the top level map because I am not sure we |
|
# are pulling it from the iterator. |
|
my $top_level_map = $navmap->getById('0.0'); |
|
# |
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $curRes = $iterator->next(); # Top level sequence |
my $curRes = $iterator->next(); # Top level sequence |
## |
## |
Line 117 sub get_sequence_assessment_data {
|
Line 121 sub get_sequence_assessment_data {
|
## We are going to loop until we run out of sequences/pages to explore for |
## We are going to loop until we run out of sequences/pages to explore for |
## resources. This means we have to start out with something to look |
## resources. This means we have to start out with something to look |
## at. |
## at. |
my $title = $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
my $title = $top_level_map->title(); |
my $symb = 'top'; |
my $symb = $top_level_map->symb(); |
my $src = 'not applicable'; |
my $src = $top_level_map->src(); |
|
my $randompick = $top_level_map->randompick(); |
# |
# |
my @Sequences; |
my @Sequences; |
my @Assessments; |
my @Assessments; |
Line 130 sub get_sequence_assessment_data {
|
Line 135 sub get_sequence_assessment_data {
|
type => 'container', |
type => 'container', |
num_assess => 0, |
num_assess => 0, |
num_assess_parts => 0, |
num_assess_parts => 0, |
contents => [], }; |
contents => [], |
|
randompick => $randompick, |
|
}; |
push (@Sequences,$top); |
push (@Sequences,$top); |
push (@Nested_Sequences, $top); |
push (@Nested_Sequences, $top); |
# |
# |
Line 146 sub get_sequence_assessment_data {
|
Line 153 sub get_sequence_assessment_data {
|
$title = $previous->title(); |
$title = $previous->title(); |
$symb = $previous->symb(); |
$symb = $previous->symb(); |
$src = $previous->src(); |
$src = $previous->src(); |
|
$randompick = $previous->randompick(); |
my $newmap = { title => $title, |
my $newmap = { title => $title, |
src => $src, |
src => $src, |
symb => $symb, |
symb => $symb, |
type => 'container', |
type => 'container', |
num_assess => 0, |
num_assess => 0, |
|
randompick => $randompick, |
contents => [], |
contents => [], |
}; |
}; |
push (@{$currentmap->{'contents'}},$newmap); # this is permanent |
push (@{$currentmap->{'contents'}},$newmap); # this is permanent |
Line 209 sub LoadDiscussion {
|
Line 218 sub LoadDiscussion {
|
return \%Discuss; |
return \%Discuss; |
} |
} |
|
|
|
################################################ |
|
################################################ |
|
|
|
=pod |
|
|
|
=item &GetUserName(username,userdomain) |
|
|
|
Returns a hash with the following entries: |
|
'firstname', 'middlename', 'lastname', 'generation', and 'fullname' |
|
|
|
'fullname' is the result of &Apache::loncoursedata::ProcessFullName. |
|
|
|
=cut |
|
|
|
################################################ |
|
################################################ |
|
sub GetUserName { |
|
my ($username,$userdomain) = @_; |
|
$username = $ENV{'user.name'} if (! defined($username)); |
|
$userdomain = $ENV{'user.domain'} if (! defined($username)); |
|
my %userenv = &Apache::lonnet::get('environment', |
|
['firstname','middlename','lastname','generation'], |
|
$userdomain,$username); |
|
$userenv{'fullname'} = &ProcessFullName($userenv{'lastname'}, |
|
$userenv{'generation'}, |
|
$userenv{'firstname'}, |
|
$userenv{'middlename'}); |
|
return %userenv; |
|
} |
|
|
|
################################################ |
|
################################################ |
|
|
=pod |
=pod |
|
|
=item &ProcessFullName() |
=item &ProcessFullName() |
Line 219 is Lastname generation, firstname middle
|
Line 261 is Lastname generation, firstname middle
|
|
|
=cut |
=cut |
|
|
|
################################################ |
|
################################################ |
sub ProcessFullName { |
sub ProcessFullName { |
my ($lastname, $generation, $firstname, $middlename)=@_; |
my ($lastname, $generation, $firstname, $middlename)=@_; |
my $Str = ''; |
my $Str = ''; |
Line 420 sub init_dbs {
|
Line 464 sub init_dbs {
|
my $courseid = shift; |
my $courseid = shift; |
&setup_table_names($courseid); |
&setup_table_names($courseid); |
# |
# |
|
# Drop any of the existing tables |
|
foreach my $table ($symb_table,$part_table,$student_table, |
|
$updatetime_table,$performance_table, |
|
$parameters_table) { |
|
&Apache::lonmysql::drop_table($table); |
|
} |
|
# |
# Note - changes to this table must be reflected in the code that |
# Note - changes to this table must be reflected in the code that |
# stores the data (calls &Apache::lonmysql::store_row with this table |
# stores the data (calls &Apache::lonmysql::store_row with this table |
# id |
# id |
Line 492 sub init_dbs {
|
Line 543 sub init_dbs {
|
{ name => 'part_id', |
{ name => 'part_id', |
type => 'MEDIUMINT UNSIGNED', |
type => 'MEDIUMINT UNSIGNED', |
restrictions => 'NOT NULL' }, |
restrictions => 'NOT NULL' }, |
|
{ name => 'part', |
|
type => 'VARCHAR(100)', |
|
restrictions => 'NOT NULL'}, |
{ name => 'solved', |
{ name => 'solved', |
type => 'TINYTEXT' }, |
type => 'TINYTEXT' }, |
{ name => 'tries', |
{ name => 'tries', |
Line 910 sub update_student_data {
|
Line 964 sub update_student_data {
|
my $awarddetail = $param_hash->{'resource.'.$part.'.awarddetail'}; |
my $awarddetail = $param_hash->{'resource.'.$part.'.awarddetail'}; |
my $timestamp = $param_hash->{'timestamp'}; |
my $timestamp = $param_hash->{'timestamp'}; |
# |
# |
$solved = '' if (! defined($awarded)); |
$solved = '' if (! defined($solved)); |
$tries = '' if (! defined($tries)); |
$tries = '' if (! defined($tries)); |
$awarded = '' if (! defined($awarded)); |
$awarded = '' if (! defined($awarded)); |
$award = '' if (! defined($award)); |
$award = '' if (! defined($award)); |
$awarddetail = '' if (! defined($awarddetail)); |
$awarddetail = '' if (! defined($awarddetail)); |
$newstring = "('".join("','",$symb_id,$student_id,$part_id, |
$newstring = "('".join("','",$symb_id,$student_id,$part_id,$part, |
$solved,$tries,$awarded,$award, |
$solved,$tries,$awarded,$award, |
$awarddetail,$timestamp)."'),\n"; |
$awarddetail,$timestamp)."'),\n"; |
$store_performance_command .= $newstring; |
$store_performance_command .= $newstring; |
Line 1059 sub get_student_data_from_performance_ca
|
Line 1113 sub get_student_data_from_performance_ca
|
# |
# |
my $dbh = &Apache::lonmysql::get_dbh(); |
my $dbh = &Apache::lonmysql::get_dbh(); |
my $request = "SELECT ". |
my $request = "SELECT ". |
"d.symb,c.part,a.solved,a.tries,a.awarded,a.award,a.awarddetail,". |
"d.symb,a.part,a.solved,a.tries,a.awarded,a.award,a.awarddetail,". |
"a.timestamp "; |
"a.timestamp "; |
if (defined($student)) { |
if (defined($student)) { |
$request .= "FROM $student_table AS b ". |
$request .= "FROM $student_table AS b ". |
"LEFT JOIN $performance_table AS a ON b.student_id=a.student_id ". |
"LEFT JOIN $performance_table AS a ON b.student_id=a.student_id ". |
"LEFT JOIN $part_table AS c ON c.part_id = a.part_id ". |
# "LEFT JOIN $part_table AS c ON c.part_id = a.part_id ". |
"LEFT JOIN $symb_table AS d ON d.symb_id = a.symb_id ". |
"LEFT JOIN $symb_table AS d ON d.symb_id = a.symb_id ". |
"WHERE student='$student'"; |
"WHERE student='$student'"; |
if (defined($symb) && $symb ne '') { |
if (defined($symb) && $symb ne '') { |
Line 1073 sub get_student_data_from_performance_ca
|
Line 1127 sub get_student_data_from_performance_ca
|
} elsif (defined($symb) && $symb ne '') { |
} elsif (defined($symb) && $symb ne '') { |
$request .= "FROM $symb_table as d ". |
$request .= "FROM $symb_table as d ". |
"LEFT JOIN $performance_table AS a ON d.symb_id=a.symb_id ". |
"LEFT JOIN $performance_table AS a ON d.symb_id=a.symb_id ". |
"LEFT JOIN $part_table AS c ON c.part_id = a.part_id ". |
# "LEFT JOIN $part_table AS c ON c.part_id = a.part_id ". |
"LEFT JOIN $student_table AS b ON b.student_id = a.student_id ". |
"LEFT JOIN $student_table AS b ON b.student_id = a.student_id ". |
"WHERE symb='".$dbh->quote($symb)."'"; |
"WHERE symb='".$dbh->quote($symb)."'"; |
} |
} |
Line 1151 sub get_current_state {
|
Line 1205 sub get_current_state {
|
return () if (! defined($sname) || ! defined($sdom)); |
return () if (! defined($sname) || ! defined($sdom)); |
# |
# |
my ($status,$data) = &ensure_current_data($sname,$sdom,$courseid); |
my ($status,$data) = &ensure_current_data($sname,$sdom,$courseid); |
|
&Apache::lonnet::logthis |
|
('sname = '.$sname. |
|
' domain = '.$sdom. |
|
' status = '.$status. |
|
' data is '.(defined($data)?'defined':'undefined')); |
|
# while (my ($symb,$hash) = each(%$data)) { |
|
# &Apache::lonnet::logthis($symb."\n----------------------------------"); |
|
# while (my ($key,$value) = each (%$hash)) { |
|
# &Apache::lonnet::logthis(" ".$key." = ".$value); |
|
# } |
|
# } |
# |
# |
if (defined($data)) { |
if (defined($data)) { |
if (defined($symb)) { |
if (defined($symb)) { |