Index: openacs-4/packages/imsld/tcl/imsld-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-callback-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/tcl/imsld-callback-procs.tcl 25 Apr 2007 10:52:30 -0000 1.5 +++ openacs-4/packages/imsld/tcl/imsld-callback-procs.tcl 13 Nov 2008 23:39:32 -0000 1.6 @@ -67,3 +67,74 @@ } } + +ad_proc -callback as::session::update -impl imsld { + -assessment_id + -session_id + -user_id + -start_time + -end_time + -percent_score + -elapsed_time + -package_id + -session_points + -assessment_points +} { +

Callback that updates a test's score in the course

+ + @author Javier Morales Puerta (javomorales@gmail.es) +} { + if { [catch {set resource_id [imsld::get_resource_from_object -object_id $assessment_id]} errmsg] } { + ns_log notice "IMS-LD: QTI independent" + return + } + + # get the resource identifier + set resource_ident [ db_string get_identifier { + select identifier + from imsld_cp_resources + where resource_id = :resource_id + } -default ""] + + set activity_list [lindex [imsld::get_activity_from_resource -resource_id $resource_id] 0] + + # set the activity_id, activity_item_id and activity_type + set activity_id [lindex $activity_list 0] + set activity_item_id [lindex $activity_list 1] + set activity_type [lindex $activity_list 2] + + set imsld_id [imsld::get_imsld_from_activity -activity_id $activity_id -activity_type $activity_type] + + set aux "$resource_ident%" + + set item_prop_id [db_string get_property_id { + select ip.item_id + from imsld_propertiesi ip, + imsld_componentsi ici, + imsld_imsldsi iii, + imsld_imslds ims + where ip.component_id = ici.item_id + and ici.imsld_id = iii.item_id + and iii.revision_id = ims.imsld_id + and ims.imsld_id = :imsld_id + and ip.identifier like :aux + }] + + set property_id [content::item::get_live_revision -item_id $item_prop_id] + + set run_id [db_string get_run { + select c.run_id + from acs_rels a, imsld_runs b, imsld_run_users_group_ext c + where a.rel_type='imsld_run_users_group_rel' + and a.object_id_two=:user_id + and b.imsld_id=:imsld_id + and c.run_id=b.run_id + and c.group_id=a.object_id_one + }] + + ns_log notice "imsld::runtime::property::property_value_set -user_id $user_id -run_id $run_id -property_id $property_id -value $assessment_points" + imsld::runtime::property::property_value_set -user_id $user_id -run_id $run_id -property_id $property_id -value $assessment_points + + ns_log notice " --- property updated --- " + return +}