Index: openacs-4/packages/assessment/tcl/assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/assessment-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/tcl/assessment-procs.tcl 22 Sep 2004 15:27:09 -0000 1.11 +++ openacs-4/packages/assessment/tcl/assessment-procs.tcl 23 Sep 2004 14:20:55 -0000 1.12 @@ -72,7 +72,7 @@ @author Natalia Perez (nperper@it.uc3m.es) @creation-date 2004-07-26 - New Item Display RadioButton Type to the data database + New Item Display RadioButton Type to the database } { set package_id [ad_conn package_id] set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"] @@ -84,6 +84,29 @@ return $as_item_display_rb_id } +ad_proc -public as_item_display_cb_new { + {-name:required} + {-html_display_options ""} + {-choice_orientation ""} + {-choice_label_orientation ""} + {-sort_order_type ""} + {-item_answer_alignment ""} +} { + @author Eduardo Perez (eperez@it.uc3m.es) + @creation-date 2004-09-23 + + New Item Display CheckBox Type to the database +} { + set package_id [ad_conn package_id] + set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"] + + # Insert as_item_display_cb in the CR (and as_item_display_cb table) getting the revision_id (as_item_display_id) + set item_item_display_cb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_cb} -name $name] + set as_item_display_cb_id [content::revision::new -item_id $item_item_display_cb_id -content_type {as_item_display_cb} -attributes [list [list html_display_options $html_display_options] [list choice_orientation $choice_orientation] [list choice_label_orientation $choice_label_orientation] [list sort_order_type $sort_order_type] [list item_answer_alignment $item_answer_alignment] ] ] + + return $as_item_display_cb_id +} + ad_proc -public as_item_new { {-name:required} {-title:required} @@ -189,13 +212,13 @@ set package_id [ad_conn package_id] set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"] - # Check to see if there's a session already to not submit another one - db_0or1row as_session_last {SELECT session_id AS as_session_id FROM as_sessionsx WHERE subject_id = :subject_id AND assessment_id = :assessment_id} - if { ! [info exists as_session_id] } { +# # Check to see if there's a session already to not submit another one +# db_0or1row as_session_last {SELECT session_id AS as_session_id FROM as_sessionsx WHERE subject_id = :subject_id AND assessment_id = :assessment_id} +# if { ! [info exists as_session_id] } { # Insert as_session in the CR (and as_sessions table) getting the revision_id (session_id) - set session_id [content::item::new -parent_id $folder_id -content_type {as_sessions} -name "$subject_id-$assessment_id" -title "$subject_id-$assessment_id" ] - set as_session_id [content::revision::new -item_id $session_id -content_type {as_sessions} -title "$subject_id-$assessment_id" -attributes [list [list assessment_id $assessment_id] [list subject_id $subject_id] [list staff_id $staff_id] [list target_datetime $target_datetime] [list creation_datetime $creation_datetime] [list first_mod_datetime $first_mod_datetime] [list last_mod_datetime $last_mod_datetime] [list completed_datetime $completed_datetime] [list percent_score $percent_score] [list consent_timestamp $consent_timestamp] ] ] - } + set session_id [content::item::new -parent_id $folder_id -content_type {as_sessions} -name "$subject_id-$assessment_id-[ad_generate_random_string]" -title "$subject_id-$assessment_id-[ad_generate_random_string]" ] + set as_session_id [content::revision::new -item_id $session_id -content_type {as_sessions} -title "$subject_id-$assessment_id-[ad_generate_random_string]" -attributes [list [list assessment_id $assessment_id] [list subject_id $subject_id] [list staff_id $staff_id] [list target_datetime $target_datetime] [list creation_datetime $creation_datetime] [list first_mod_datetime $first_mod_datetime] [list last_mod_datetime $last_mod_datetime] [list completed_datetime $completed_datetime] [list percent_score $percent_score] [list consent_timestamp $consent_timestamp] ] ] +# } return $as_session_id } Index: openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/assessment-qti-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl 22 Sep 2004 19:34:18 -0000 1.18 +++ openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl 23 Sep 2004 14:20:55 -0000 1.19 @@ -173,16 +173,19 @@ set as_items__rcardinality [$response_lid getAttribute {rcardinality} {}] # multiple choice either text (remember it can be internationalized or changed), images, sounds, videos # this is the default - set as_item__display_type_id 2 + set as_item_display_id {} if {$as_items__rcardinality == {Multiple}} { # multiple response either text (remember it can be internationalized or changed), images, sounds, videos - set as_item__display_type_id 3 + set as_item_display_id [as_item_display_cb_new -name [ad_generate_random_string]] + } else { + set as_item_display_id [as_item_display_rb_new -name [ad_generate_random_string]] } set as_item_type_id [as_item_type_mc_new -name $as_item_type__name] # Insert as_item in the CR (and as_items table) getting the revision_id (as_item_id) set as_item_id [as_item_new -name $as_items__name -title $as_items__title] lappend items $as_item_id content::item::relate -item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] -object_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_type_id"] -relation_tag {as_item_type_rel} -relation_type {cr_item_rel} + content::item::relate -item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] -object_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_display_id"] -relation_tag {as_item_display_rel} -relation_type {cr_item_rel} set response_labelNodes [$presentation selectNodes {.//response_label}] foreach response_label $response_labelNodes { set as_item_choices__ident [$response_label getAttribute {ident}] Index: openacs-4/packages/assessment/tcl/item-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/item-form-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/item-form-procs.tcl 21 Sep 2004 15:07:11 -0000 1.3 +++ openacs-4/packages/assessment/tcl/item-form-procs.tcl 23 Sep 2004 14:20:55 -0000 1.4 @@ -9,6 +9,12 @@ db_1row item_properties "" set user_value "" + set item_item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:item_id"] + set item_display_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE relation_tag = 'as_item_display_rel' AND item_id=:item_item_id"] + db_0or1row as_item_display_rbx "SELECT item_id AS as_item_display_rbx__item_id FROM as_item_display_rbx WHERE item_id=:item_display_id" + set presentation_type "checkbox" ;# DEFAULT + if {[info exists as_item_display_rbx__item_id]} {set presentation_type "radiobutton"} + #Add the items depending on the type (as_item_display_types) switch -- $presentation_type { "textbox" { @@ -35,7 +41,7 @@ "radiobutton" { set widget "text(radio)" set item_item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:item_id"] - set item_mc_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE item_id=:item_item_id"] + set item_mc_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE relation_tag = 'as_item_type_rel' AND item_id=:item_item_id"] set mc_id [db_string item_to_rev "SELECT revision_id FROM cr_revisions WHERE item_id=:item_mc_id"] set optionlist [list] db_foreach item_choices_2 "" { @@ -53,7 +59,7 @@ "checkbox" { set item_item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:item_id"] - set item_mc_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE item_id=:item_item_id"] + set item_mc_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE relation_tag = 'as_item_type_rel' AND item_id=:item_item_id"] set mc_id [db_string item_to_rev "SELECT revision_id FROM cr_revisions WHERE item_id=:item_mc_id"] set choices [list] set optionlist [list] Index: openacs-4/packages/assessment/tcl/item-form-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/item-form-procs.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/item-form-procs.xql 21 Sep 2004 15:07:11 -0000 1.3 +++ openacs-4/packages/assessment/tcl/item-form-procs.xql 23 Sep 2004 14:20:55 -0000 1.4 @@ -30,7 +30,7 @@ select - as_itemsx.title, as_itemsx.required_p, 'checkbox' AS presentation_type + as_itemsx.title, as_itemsx.required_p from as_itemsx where Index: openacs-4/packages/assessment/www/assessment.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/assessment.adp 22 Sep 2004 15:27:08 -0000 1.3 +++ openacs-4/packages/assessment/www/assessment.adp 23 Sep 2004 14:20:56 -0000 1.4 @@ -2,19 +2,25 @@ Assessment @context;noquote@ + + + + + + +
@assessment_name@

+ - +

   - Items + Items

- - +
@items.rownum@.- -
@items.title@ +
#assessment.Question# @items.rownum@:@items.title@
+
-
-
@formgroup.widget;noquote@ @formgroup.label;noquote@ @@ -25,11 +31,12 @@
+
- +

Index: openacs-4/packages/assessment/www/assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/assessment.tcl 22 Sep 2004 15:27:08 -0000 1.3 +++ openacs-4/packages/assessment/www/assessment.tcl 23 Sep 2004 14:20:56 -0000 1.4 @@ -11,6 +11,7 @@ set context [list "Show Items"] set as_session_id [as_session_new -assessment_id $assessment_id -subject_id [ad_conn user_id]] +set assessment_name [db_string assessment_name {SELECT as_assessmentsx.title FROM as_assessmentsx WHERE as_assessmentsx.assessment_id=:assessment_id}] db_dml session_start {UPDATE as_sessions SET creation_datetime = NOW() WHERE session_id=:as_session_id} ad_form -name show_item_form -action process-response -html {enctype multipart/form-data} -form { Index: openacs-4/packages/assessment/www/session.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/session.adp 21 Sep 2004 08:55:00 -0000 1.1 +++ openacs-4/packages/assessment/www/session.adp 23 Sep 2004 14:20:56 -0000 1.2 @@ -1,15 +1,40 @@ Assessment @context;noquote@ - + +
+ + + + + + + + + + + + +
#assessment.Review_Asessment# @assessment_name@
#assessment.User_ID#: @session_user_name@#assessment.Attempt#: @session_attempt@ / Unlimited#assessment.Out_of#: @assessment_score@
#assessment.Started#: @session_start@#assessment.Finished#: @session_finish@#assessment.Time_spent#: @session_time@
+ + +
- - - - + + + + + +
@items.rownum@.- -
@items.title@
- @items.choice_html;noquote@ -
Question @items.rownum@  (@items.maxscore@ points)
+ @items.title@ +
+ Student response: + @items.choice_html;noquote@
@items.feedback_text@
+ Score:@items.score@ / @items.maxscore@ + (Question not answered.)

+ +
+Total score: @session_score@ / @assessment_score@
Index: openacs-4/packages/assessment/www/session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/session.tcl 21 Sep 2004 11:54:34 -0000 1.2 +++ openacs-4/packages/assessment/www/session.tcl 23 Sep 2004 14:20:56 -0000 1.3 @@ -7,28 +7,48 @@ context:onevalue } -set context [list "Show Session Results"] +set context [list "View Results"] -db_multirow -extend choice_html items query_all_items {} { +set assessment_name [db_string assessment_name {SELECT as_assessmentsx.title FROM as_assessmentsx INNER JOIN as_sessionsx ON as_assessmentsx.assessment_id = as_sessionsx.assessment_id WHERE as_sessionsx.session_id=:session_id}] +db_1row session_user_id {SELECT persons.first_names, persons.last_name, assessment_id FROM as_sessionsx INNER JOIN persons ON as_sessionsx.subject_id = persons.person_id WHERE as_sessionsx.session_id=:session_id} +set assessment_url [export_vars -base "assessment" {session_id}] +set session_user_name "$first_names $last_name" +db_1row session_data {SELECT subject_id, creation_datetime AS session_start, completed_datetime AS session_finish, completed_datetime-creation_datetime AS session_time FROM as_sessionsx WHERE as_sessionsx.session_id = :session_id} +set session_user_url [acs_community_member_url -user_id $subject_id] +set session_attempt [db_string session_attempt {SELECT COUNT(*) FROM as_sessionsx WHERE as_sessionsx.subject_id = :subject_id AND as_sessionsx.assessment_id=:assessment_id}] +set assessment_score 100 ;# FIXME +set assessment_items [db_string assessment_items {SELECT COUNT(*) FROM (as_sectionsx INNER JOIN (as_assessmentsx INNER JOIN as_assessment_section_map ON as_assessmentsx.assessment_id=as_assessment_section_map.assessment_id) ON as_sectionsx.section_id=as_assessment_section_map.section_id) INNER JOIN (as_itemsx INNER JOIN as_item_section_map ON as_itemsx.as_item_id=as_item_section_map.as_item_id) ON as_sectionsx.section_id=as_item_section_map.section_id WHERE as_assessmentsx.assessment_id = :assessment_id}] +set itemmaxscore [expr $assessment_score/$assessment_items] ;# FIXME total_points/items_number + +set session_score 0 +db_multirow -extend [list choice_html score maxscore notanswered item_correct] items query_all_items {} { set item_item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] - set item_mc_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE item_id=:item_item_id"] + set item_mc_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE relation_tag = 'as_item_type_rel' AND item_id=:item_item_id"] set mc_id [db_string item_to_rev "SELECT revision_id FROM cr_revisions WHERE item_id=:item_mc_id"] - set choice_html {