Index: openacs-4/packages/assessment/www/last-session-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/last-session-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/last-session-postgresql.xql 20 Dec 2004 13:28:21 -0000 1.1
@@ -0,0 +1,47 @@
+
+
+
+ postgresql7.1
+
+
+
+ SELECT s.session_id, s.name, s.title, s.completed_datetime, s.percent_score,
+ p.first_names || ' ' || p.last_name AS subject_name,
+ a.title AS assessment_name, s.subject_id
+ FROM as_sessionsx s, as_assessmentsx a, persons p
+ WHERE s.assessment_id = a.assessment_id
+ AND s.subject_id = p.person_id
+ AND s.assessment_id = :assessment_id
+ AND s.last_mod_datetime IN (
+ SELECT max(s.last_mod_datetime) as last_mod_datetime
+ FROM as_sessionsx s, as_assessmentsx a, persons p
+ WHERE s.assessment_id = a.assessment_id
+ AND s.subject_id = p.person_id
+ AND s.assessment_id = :assessment_id
+ GROUP BY s.subject_id
+ )
+
+
+
+
+
+ SELECT s.session_id, s.name, s.title, s.completed_datetime, s.percent_score,
+ p.first_names || ' ' || p.last_name AS subject_name,
+ a.title AS assessment_name, s.subject_id
+ FROM as_sessionsx s, as_assessmentsx a, persons p
+ WHERE s.assessment_id = a.assessment_id
+ AND s.subject_id = p.person_id
+ AND s.assessment_id = :assessment_id
+ AND s.subject_id = :subject_id
+ AND s.last_mod_datetime IN (
+ SELECT max(s.last_mod_datetime) as last_mod_datetime
+ FROM as_sessionsx s, as_assessmentsx a, persons p
+ WHERE s.assessment_id = a.assessment_id
+ AND s.subject_id = p.person_id
+ AND s.assessment_id = :assessment_id
+ AND s.subject_id = :subject_id
+ GROUP BY s.subject_id
+ )
+
+
+
Index: openacs-4/packages/assessment/www/last-session.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/last-session.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/last-session.adp 20 Dec 2004 13:28:21 -0000 1.1
@@ -0,0 +1,7 @@
+
+Assessment
+@context;noquote@
+
+
+
+
Index: openacs-4/packages/assessment/www/last-session.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/last-session.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/last-session.tcl 20 Dec 2004 13:28:21 -0000 1.1
@@ -0,0 +1,84 @@
+ad_page_contract {
+
+ Lists the identifier of sessions, the name of subjects that took
+ this assessment, the name of assessment and the finish time
+ of assessment for an assessment.
+
+ @author Eduardo P�rez Ureta (eperez@it.uc3m.es)
+ @creation-date 2004-09-03
+} {
+ assessment_id:notnull
+} -properties {
+ context:onevalue
+ assessment_info:multirow
+}
+
+set context [list "[_ assessment.Show_Sessions]"]
+
+set package_id [ad_conn package_id]
+
+#get the user that take an assessment
+set subject_id [ad_conn user_id]
+
+#Lists the identifier of sessions, the name of subjects that took this assessment, the name of assessment and the finished time
+#of assessment for an assessment.
+template::list::create \
+ -name sessions \
+ -multirow sessions \
+ -pass_properties { package_id } \
+ -key sessions_id \
+ -elements {
+ session_id {
+ label {[_ assessment.Session]}
+ link_url_eval {[export_vars -base "session" {session_id}]}
+ }
+ subject_name {
+ label {[_ assessment.Subject_Name]}
+ link_url_eval {[acs_community_member_url -user_id $subject_id]}
+
+ }
+ assessment_name {
+ label {Assessment}
+ link_url_eval {[export_vars -base "assessment" {assessment_id}]}
+ }
+ completed_datetime {
+ label {[_ assessment.Finish_Time]}
+ html {nowrap}
+ }
+ percent_score {
+ label {[_ assessment.Percent_Score]}
+ html {nowrap}
+ }
+ other_sessions {
+ label {[_ assessment.Other_Sessions]}
+ link_url_eval {[site_node::get_url_from_object_id -object_id $package_id]sessions?[export_vars {assessment_id subject_id}]}
+ }
+ } \
+ -main_class {
+ narrow
+ }
+
+set admin_p [ad_permission_p $package_id admin]
+
+set assessment_id_multi $assessment_id
+#if the user is admin he will display all sessions from all subjects
+if { $admin_p } {
+db_multirow -extend { item_url assessment_id other_sessions } sessions sessions_of_assessment {
+} {
+ set item_url [export_vars -base "session" {session_id}]
+ set assessment_id $assessment_id_multi
+ set other_sessions "[_ assessment.View_Other_Sessions]"
+}
+#if the user is not admin he will display only his sessions
+} else {
+db_multirow -extend { item_url assessment_id other_sessions } sessions sessions_of_assessment_of_subject {
+} {
+ set item_url [export_vars -base "session" {session_id}]
+ set assessment_id $assessment_id_multi
+ set other_sessions "[_ assessment.View_Other_Sessions]"
+}
+}
+
+set admin_p [ad_permission_p $package_id admin]
+
+ad_return_template