Index: dotlrn_packages/packages/forums/tcl/forums-lams-procs.tcl =================================================================== diff -u -r65db013a19bd8cb4c71202f71dc4d09ceaff2c15 -r20fb2de1de4b8f2b094cecb83d44189a5a9fc2e7 --- dotlrn_packages/packages/forums/tcl/forums-lams-procs.tcl (.../forums-lams-procs.tcl) (revision 65db013a19bd8cb4c71202f71dc4d09ceaff2c15) +++ dotlrn_packages/packages/forums/tcl/forums-lams-procs.tcl (.../forums-lams-procs.tcl) (revision 20fb2de1de4b8f2b094cecb83d44189a5a9fc2e7) @@ -206,5 +206,58 @@ ns_set put [ad_conn outputheaders] Content-Size "[file size $path_to_file]" ns_returnfile 200 text/html $path_to_file +} + +## Tool Ouputs + +ad_proc -public forum::lams::output_number_of_postings { + -forum_id:required + -user_id:required +} { + Returns the number of postings per Forum per user + +} { + + if {[db_0or1row number_of_postings {}]} { + + return $count + + } else { + + return 0 + } + } + + +ad_proc -public forum::lams::output_number_of_words { + -forum_id:required + -user_id:required +} { + Returns the number of words in all messages per user in a forum + +} { + + set word_count "" + db_foreach number_of_words {} { + + # if we catch that the content is HTML we turn it into plain + # text + if {[string equal $format "text/html"]} { + + set content [ad_html_text_convert -from "text/html" -to "text/plain" $content] + + } + + set word_count [concat $word_count $content] + + } if_no_rows { + + set word_count "" + + } + + return [llength $word_count] + +} \ No newline at end of file Index: dotlrn_packages/packages/forums/tcl/forums-lams-procs.xql =================================================================== diff -u -rd886350dc86c4b801a38faf4a9c69a0b8dafc5b3 -r20fb2de1de4b8f2b094cecb83d44189a5a9fc2e7 --- dotlrn_packages/packages/forums/tcl/forums-lams-procs.xql (.../forums-lams-procs.xql) (revision d886350dc86c4b801a38faf4a9c69a0b8dafc5b3) +++ dotlrn_packages/packages/forums/tcl/forums-lams-procs.xql (.../forums-lams-procs.xql) (revision 20fb2de1de4b8f2b094cecb83d44189a5a9fc2e7) @@ -37,4 +37,17 @@ ap.package_key='forums' + + + + select count(user_id) from forums_messages where forum_id = :forum_id and user_id = :user_id + + + + + + select format, content from forums_messages where forum_id = :forum_id and user_id = :user_id + + + \ No newline at end of file