Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v
diff -u -r1.34 -r1.35
--- openacs-4/packages/imsld/tcl/imsld-procs.tcl 9 Feb 2006 13:28:06 -0000 1.34
+++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 22 Feb 2006 16:09:39 -0000 1.35
@@ -61,18 +61,23 @@
from imsld_role_partsi
where learning_activity_id = :leaf_id
}] } {
- return $role_part_id
+ return [list $role_part_id]
}
- # the learning activity is referenced by an activity structure... digg more
- db_1row get_la_activity_structure {
+ set role_part_list [list]
+ # the learning activity is referenced by some activity structures... digg more
+ foreach la_structure_list [db_list_of_lists get_la_activity_structures {
select ias.structure_id, ias.item_id as leaf_id
from imsld_activity_structuresi ias, acs_rels ar, imsld_learning_activitiesi la
where ar.object_id_one = ias.item_id
and ar.object_id_two = la.item_id
and content_revision__is_live(ias.structure_id) = 't'
and la.item_id = :leaf_id
+ }] {
+ set stucture_id [lindex $la_structure_list 0]
+ set leaf_id [lindex $la_structure_list 1]
+ lappend role_part_list [imsld::get_role_part_from_activity -activity_type structure -leaf_id $leaf_id]
}
- return [imsld::get_role_part_from_activity -activity_type structure -leaf_id $leaf_id]
+ return $role_part_list
}
support {
if { [db_0or1row directly_mapped {
@@ -99,17 +104,22 @@
from imsld_role_partsi
where activity_structure_id = :leaf_id
}] } {
- return $role_part_id
+ return [list $role_part_id]
}
# the activity structure is referenced by an activity structure... digg more
- db_1row get_as_activity_structure {
- select ias.structure_id, ias.item_id as structure_item_id
+ set role_part_list [list]
+ foreach sa_structure_list [db_list_of_lists get_as_activity_structures {
+ select ias.structure_id, ias.item_id as leaf_id
from imsld_activity_structuresi ias, acs_rels ar
where ar.object_id_one = ias.item_id
and ar.object_id_two = :leaf_id
and content_revision__is_live(ias.structure_id) = 't'
+ }] {
+ set stucture_id [lindex $sa_structure_list 0]
+ set leaf_id [lindex $sa_structure_list 1]
+ lappend role_part_list [imsld::get_role_part_from_activity -activity_type structure -leaf_id $leaf_id]
}
- return [imsld::get_role_part_from_activity -activity_type structure -leaf_id $leaf_id]
+ return $role_part_list
}
}
}
@@ -329,45 +339,46 @@
set la_item_id [lindex $referenced_la 0]
set activity_id [lindex $referenced_la 1]
set time_in_seconds [lindex $referenced_la 2]
- set role_part_id [imsld::get_role_part_from_activity -activity_type learning -leaf_id $la_item_id]
- db_1row get_la_activity_info {
+ foreach role_part_referencer [db_list_of_lists get_la_activity_references {
select icm.manifest_id,
+ irp.role_part_id,
ii.imsld_id,
ip.play_id,
ia.act_id,
icm.creation_date
from imsld_cp_manifestsi icm, imsld_cp_organizationsi ico,
imsld_imsldsi ii, imsld_methodsi im, imsld_playsi ip,
imsld_actsi ia, imsld_role_partsi irp
- where irp.role_part_id = :role_part_id
+ where irp.learning_activity_id = :la_item_id
and irp.act_id = ia.item_id
and ia.play_id = ip.item_id
and ip.method_id = im.item_id
and im.imsld_id = ii.item_id
and ii.organization_id = ico.item_id
and ico.manifest_id = icm.item_id
and content_revision__is_live(icm.manifest_id) = 't'
- }
- if { [db_0or1row compre_times {
- select 1
- where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
- }] } {
- # the act has been expired, let's mark it as finished
- set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
- db_foreach user_in_class {
- select app.user_id
- from dotlrn_member_rels_approved app
- where app.community_id = :community_id
- and app.member_state = 'approved'
- } {
- imsld::finish_component_element -imsld_id $imsld_id \
- -play_id $play_id \
- -act_id $act_id \
- -role_part_id $role_part_id \
- -element_id $activity_id \
- -type learning \
- -user_id $user_id \
- -code_call
+ }] {
+ if { [db_0or1row compre_times {
+ select 1
+ where (extract(epoch from now()) - extract(epoch from timestamp :creation_date) - :time_in_seconds > 0)
+ }] } {
+ # the act has been expired, let's mark it as finished
+ set community_id [imsld::community_id_from_manifest_id -manifest_id $manifest_id]
+ db_foreach user_in_class {
+ select app.user_id
+ from dotlrn_member_rels_approved app
+ where app.community_id = :community_id
+ and app.member_state = 'approved'
+ } {
+ imsld::finish_component_element -imsld_id $imsld_id \
+ -play_id $play_id \
+ -act_id $act_id \
+ -role_part_id $role_part_id \
+ -element_id $activity_id \
+ -type learning \
+ -user_id $user_id \
+ -code_call
+ }
}
}
}
@@ -423,8 +434,8 @@
}
set resources_activities_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
- #grant permissions for newly appeared resources
- imsld::grant_permissions -resources_activities_list $resources_activities_list -user_id $user_id
+ #grant permissions for newly showed resources
+ imsld::grant_permissions -resources_activities_list $resources_activities_list -user_id $user_id
}
ad_proc -public imsld::mark_act_finished {
@@ -637,7 +648,6 @@
-content_type $content_type \
-creation_user $user_id \
-creation_ip $creation_ip \
- -item_id $item_id \
-is_live "t" \
-attributes $attributes]
} else {
@@ -646,7 +656,6 @@
-content_type $content_type \
-creation_user $user_id \
-creation_ip $creation_ip \
- -item_id $item_id \
-is_live "t"]
}
@@ -891,22 +900,51 @@
ad_proc -public imsld::structure_next_activity {
-activity_structure_id:required
{-environment_list ""}
+ -imsld_id
+ -role_part_id
+ {-structures_names ""}
} {
- @return The next learning or support activity (and the type) in the activity structure. 0 if there are none (which should never happen)
+ @return The next learning or support activity (and the type) in the activity structure. 0 if there are none (which should never happen), the next activity type and the list of the structure names of the activity structures in the path of the returned activity
} {
set user_id [ad_conn user_id]
set min_sort_order ""
set next_activity_id ""
set next_activity_type ""
+ # mark structure started
+ if { ![db_0or1row already_marked {
+ select 1 from imsld_status_user
+ where imsld_id = :imsld_id and user_id = :user_id and related_id = :activity_structure_id and status = 'started'
+ }] } {
+ db_dml mark_structure_started {
+ insert into imsld_status_user (imsld_id,
+ role_part_id,
+ related_id,
+ user_id,
+ type,
+ status_date,
+ status)
+ (
+ select :imsld_id,
+ :role_part_id,
+ :activity_structure_id,
+ :user_id,
+ 'structure',
+ now(),
+ 'started'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :activity_structure_id and status = 'started')
+ )
+ }
+
+ lappend structures_names [db_string get_structure_name {
+ select
+ coalesce(title,identifier) as structure_name
+ from imsld_activity_structuresi
+ where structure_id = :activity_structure_id
+ }]
+ }
+
# get referenced activities
- foreach referenced_activity [db_list_of_lists struct_referenced_activities {
- select ar.object_id_two,
- ar.rel_type
- from acs_rels ar, imsld_activity_structuresi ias
- where ar.object_id_one = ias.item_id
- and ias.structure_id = :activity_structure_id
- order by ar.object_id_two
- }] {
+ foreach referenced_activity [db_list_of_lists struct_referenced_activities { *SQL* }] {
set object_id_two [lindex $referenced_activity 0]
set rel_type [lindex $referenced_activity 1]
switch $rel_type {
@@ -942,16 +980,10 @@
}
imsld_as_as_rel {
# recursive call?
- db_1row get_as_info {
- select sort_order, structure_id, item_id
- from imsld_activity_structuresi
- where item_id = :object_id_two
- and content_revision__is_live(structure_id) = 't'
- }
-
+ db_1row get_as_info { *SQL* }
if { ![db_string completed_p { *SQL* }] && ( [string eq "" $min_sort_order] || $sort_order < $min_sort_order ) } {
set min_sort_order $sort_order
- set activity_id $structure_id
+ set next_activity_id $structure_id
set next_activity_type structure
}
}
@@ -966,12 +998,13 @@
}
if { [string eq $next_activity_type structure] } {
- set next_activity_list [imsld::structure_next_activity -activity_structure_id $activity_id -environment_list $environment_list]
+ set next_activity_list [imsld::structure_next_activity -activity_structure_id $next_activity_id -environment_list $environment_list -imsld_id $imsld_id -role_part_id $role_part_id -structures_names $structures_names]
set next_activity_id [lindex $next_activity_list 0]
set next_activity_type [lindex $next_activity_list 1]
set environment_list [concat $environment_list [lindex $next_activity_list 2]]
+ set structures_names [lindex $next_activity_list 3]
}
- return [list $next_activity_id $next_activity_type $environment_list]
+ return [list $next_activity_id $next_activity_type $environment_list $structures_names]
}
ad_proc -public imsld::role_part_finished_p {
@@ -1171,7 +1204,8 @@
}
}
default {
- return "not_implemented_yet ($service_type)"
+ ad_return_error "send-mail serivce not implemented yet" "Sorry, that service type ($service_type) hasn't been implemented yet. But be patience, we are working on it =)"
+ ad_script_abort
}
}
if {[string eq "t" $resource_mode]} {
@@ -1215,29 +1249,12 @@
and content_revision__is_live(learning_object_id) = 't'
}] } {
# learning object item. get the files associated
- set linear_item_list [db_list item_linear_list {
- select ii.imsld_item_id
- from imsld_items ii,
- cr_items cr,
- acs_rels ar
- where ar.object_id_one = :learning_object_item_id
- and ar.object_id_two = cr.item_id
- and cr.live_revision = ii.imsld_item_id
- }]
+ set linear_item_list [db_list_of_lists item_linear_list { *SQL* }]
foreach imsld_item_id $linear_item_list {
- db_foreach env_nested_associated_items {
- select cpr.resource_id,
- cpr.item_id as resource_item_id,
- cpr.type as resource_type
- from imsld_cp_resourcesi cpr, imsld_itemsi ii,
- acs_rels ar
- where ar.object_id_one = ii.item_id
- and ar.object_id_two = cpr.item_id
- and content_revision__is_live(cpr.resource_id) = 't'
- and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
- or ii.imsld_item_id = :imsld_item_id)
- } {
+ foreach environments_list [db_list_of_lists env_nested_associated_items { *SQL* }] {
+ set resource_id [lindex $environments_list 0]
+ set resource_item_id [lindex $environments_list 1]
+ set resource_type [lindex $environments_list 2]
if { [string eq "t" $resource_mode] } {
lappend resource_item_list $resource_item_id
}
@@ -1246,17 +1263,19 @@
lappend environment_learning_objects_list "[_ imsld.lt_li_desc_no_file_assoc]"
} else {
if { [string eq "t" $resource_mode] } {
- set environment_learning_objects_list [concat [list $environment_learning_objects_list] \
+ set environment_learning_objects_list [concat $environment_learning_objects_list \
[list $one_learning_object_list] \
$resource_item_list ]
} else {
- set environment_learning_objects_list [concat [list $environment_learning_objects_list] \
- [list $one_learning_object_list] ]
+ if { ![string eq "" $environment_learning_objects_list] } {
+ set environment_learning_objects_list [concat $environment_learning_objects_list \
+ [list $one_learning_object_list]]
+ } else {
+ set environment_learning_objects_list $one_learning_object_list
+ }
}
}
- } if_no_rows {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
- }
+ }
}
}
# services
@@ -1270,20 +1289,20 @@
where environment_id = :environment_item_id
and content_revision__is_live(service_id) = 't'
}] } {
- set environment_services_list [imsld::process_service -service_item_id $service_item_id -resource_mode $resource_mode]
+ if { [string eq "" $environment_services_list] } {
+ set environment_services_list [imsld::process_service -service_item_id $service_item_id -resource_mode $resource_mode]
+ } else {
+ set environment_services_list [concat $environment_services_list \
+ [imsld::process_service -service_item_id $service_item_id -resource_mode $resource_mode]]
+ }
}
set nested_environment_list [list]
# environments
- db_foreach nested_environment {
- select ar.object_id_two as nested_environment_item_id
- from acs_rels ar
- where ar.object_id_one = :environment_item_id
- and ar.rel_type = 'imsld_env_env_rel'
- } {
+ foreach nested_environment_item_id [db_list nested_environment { *SQL* }] {
set one_nested_environment_list [imsld::process_environment -environment_item_id $nested_environment_item_id]
# the title is stored in [lindex $one_nested_environment_list 0], but is not returned for displaying porpouses
- set nested_environment_list [concat [list $nested_environment_list] \
+ set nested_environment_list [concat $nested_environment_list \
[list [lindex $one_nested_environment_list 1] \
[lindex $one_nested_environment_list 2] \
[lindex $one_nested_environment_list 3]]]
@@ -1367,7 +1386,7 @@
}
set one_objective_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
if { [string eq "" $one_objective_urls] } {
- lappend objective_items_list "[_ imsld.lt_li_desc_no_file_assoc]"
+ ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
} else {
set objective_items_list [concat [list $objective_items_list] [list $one_objective_urls]]
}
@@ -1461,7 +1480,7 @@
}
set one_prerequisite_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
if { [string eq "" $one_prerequisite_urls] } {
- lappend prerequisite_items_list "[_ imsld.lt_li_desc_no_file_assoc]"
+ ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
} else {
set prerequisite_items_list [concat [list $prerequisite_items_list] [list $one_prerequisite_urls] ]
}
@@ -1541,7 +1560,7 @@
} {
@param resource_item_id
- @return The list (li) of files associated to the given resource_id
+ @return The list of files associated to the given resource_id
} {
set community_id [expr { [string eq "" $community_id] ? "[dotlrn_community::get_community_id]" : $community_id }]
db_1row get_resource_info {
@@ -1578,16 +1597,21 @@
-package_key "file-storage"]
set root_folder_id [fs::get_root_folder -package_id $fs_package_id]
# get associated files
- db_foreach associated_files {
+ foreach file_list [db_list_of_lists associated_files {
select cpf.imsld_file_id,
cpf.file_name,
- cpf.item_id, cpf.parent_id
+ cpf.item_id,
+ cpf.parent_id
from imsld_cp_filesx cpf,
acs_rels ar
where ar.object_id_one = :resource_item_id
and ar.object_id_two = cpf.item_id
and content_revision__is_live(cpf.imsld_file_id) = 't'
- } {
+ }] {
+ set imsld_file_id [lindex $file_list 0]
+ set file_name [lindex $file_list 1]
+ set item_id [lindex $file_list 2]
+ set parent_id [lindex $file_list 3]
# get the fs file path
set folder_path [db_exec_plsql get_folder_path { select content_item__get_path(:parent_id,:root_folder_id); }]
set fs_file_url [db_1row get_fs_file_url {
@@ -1603,7 +1627,6 @@
}]
set file_url "[apm_package_url_from_id $fs_package_id]view/${file_url}"
append files_urls " "
-
}
# get associated urls
db_foreach associated_urls {
@@ -1613,7 +1636,8 @@
where ar.object_id_one = :resource_item_id
and ar.object_id_two = links.extlink_id
} {
- append files_urls "
"
+
+ append files_urls "
"
}
}
return $files_urls
@@ -1683,7 +1707,7 @@
and cr2.live_revision = ii.imsld_item_id
}]
foreach imsld_item_id $linear_item_list {
- db_foreach la_nested_associated_items {
+ foreach la_items_list [db_list_of_lists la_nested_associated_items {
select cpr.resource_id,
cpr.item_id as resource_item_id,
cpr.type as resource_type
@@ -1695,14 +1719,17 @@
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
- } {
+ }] {
+ set resource_id [lindex $la_items_list 0]
+ set resource_item_id [lindex $la_items_list 1]
+ set resource_type [lindex $la_items_list 2]
if {[string eq "t" $resource_mode] } {
lappend la_resource_item_list $resource_item_id
}
set one_activity_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
if { [string eq "" $one_activity_urls] } {
- lappend activity_items_list "[_ imsld.lt_li_desc_no_file_assoc]"
+ ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
} else {
if { [llength $activity_items_list] } {
set activity_items_list [concat $activity_items_list [list $one_activity_urls]]
@@ -1714,8 +1741,6 @@
lappend activity_items_list $la_resource_item_list
}
- } if_no_rows {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
}
}
@@ -1724,13 +1749,13 @@
if { ![string eq "" $on_completion_item_id] } {
set feedbacks_list [imsld::process_feedback -on_completion_item_id $on_completion_item_id]
}
- if {[string eq "t" $resource_mode]} {
+ if { [string eq "t" $resource_mode] } {
#put in order the environments_id(s)
set environments_ids [concat [lindex [lindex $environments_list 1] [expr [llength [lindex $environments_list 1] ] - 1 ]] \
[lindex [lindex $environments_list 2] [expr [llength [lindex $environments_list 2] ] - 1 ]] ]
return [list [lindex $prerequisites_list [expr [llength $prerequisites_list] - 1]] \
- [lindex $objectives_list [expr [llength $objectives_list ] - 1]]\
+ [lindex $objectives_list [expr [llength $objectives_list ] - 1]] \
$environments_ids \
[lindex $activity_items_list [expr [llength $activity_items_list ] - 1]]]
@@ -1742,6 +1767,7 @@
ad_proc -public imsld::process_support_activity {
-activity_item_id:required
{-community_id ""}
+ {-resource_mode "f"}
} {
@param activity_item_id
@@ -1767,9 +1793,9 @@
foreach environment_item_id $associated_environments_list {
if { [llength $environments_list] } {
set environments_list [concat [list $environments_list] \
- [list [imsld::process_environment -environment_item_id $environment_item_id]]]
+ [list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]]]
} else {
- set environments_list [imsld::process_environment -environment_item_id $environment_item_id]
+ set environments_list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]
}
}
@@ -1788,7 +1814,7 @@
and cr2.live_revision = ii.imsld_item_id
}]
foreach imsld_item_id $linear_item_list {
- db_foreach sa_nested_associated_items {
+ foreach sa_items_list [db_list_of_lists sa_nested_associated_items {
select cpr.resource_id,
cpr.item_id as resource_item_id,
cpr.type as resource_type
@@ -1800,19 +1826,27 @@
and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id))
or ii.imsld_item_id = :imsld_item_id)
- } {
+ }] {
+ set resource_id [lindex $sa_items_list 0]
+ set resource_item_id [lindex $sa_items_list 1]
+ set resource_type [lindex $sa_items_list 2]
+ if {[string eq "t" $resource_mode] } {
+ lappend sa_resource_item_list $resource_item_id
+ }
+
set one_activity_urls "[imsld::process_resource -resource_item_id $resource_item_id]"
if { [string eq "" $one_activity_urls] } {
- lappend activity_items_list "[_ imsld.lt_li_desc_no_file_assoc]"
+ ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
} else {
if { [llength $activity_items_list] } {
set activity_items_list [concat $activity_items_list [list $one_activity_urls]]
} else {
set activity_items_list [list $one_activity_urls]
}
}
- } if_no_rows {
- ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]"
+ if {[string eq "t" $resource_mode] } {
+ lappend activity_items_list $sa_resource_item_list
+ }
}
}
@@ -1821,13 +1855,22 @@
if { ![string eq "" $on_completion_item_id] } {
set feedbacks_list [imsld::process_feedback -on_completion_item_id $on_completion_item_id]
}
- return [list $environments_list \
- $activity_items_list \
- $feedbacks_list]
+ if { [string eq "t" $resource_mode] } {
+ #put in order the environments_id(s)
+ set environments_ids [concat [lindex [lindex $environments_list 1] [expr [llength [lindex $environments_list 1] ] - 1 ]] \
+ [lindex [lindex $environments_list 2] [expr [llength [lindex $environments_list 2] ] - 1 ]] ]
+
+ return [list $environments_ids \
+ [lindex $activity_items_list [expr [llength $activity_items_list ] - 1]]]
+
+ } else {
+ return [list $environments_list $activity_items_list $feedbacks_list]
+ }
}
ad_proc -public imsld::process_activity_structure {
-structure_item_id:required
+ {-resource_mode "f"}
} {
@param structure_item_id
@@ -1845,11 +1888,17 @@
foreach environment_item_id $associated_environments_list {
if { [llength $environments_list] } {
set environments_list [concat [list $environments_list] \
- [list [imsld::process_environment -environment_item_id $environment_item_id]]]
+ [list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]]]
} else {
- set environments_list [imsld::process_environment -environment_item_id $environment_item_id]
+ set environments_list [imsld::process_environment -environment_item_id $environment_item_id -resource_mode $resource_mode]
}
}
+ if { [string eq "t" $resource_mode] } {
+ #put in order the environments_id(s)
+ set environments_ids [concat [lindex [lindex $environments_list 1] [expr [llength [lindex $environments_list 1] ] - 1 ]] \
+ [lindex [lindex $environments_list 2] [expr [llength [lindex $environments_list 2] ] - 1 ]] ]
+ }
+
return $environments_list
}
@@ -1868,15 +1917,19 @@
@return The list (activity_name, list of associated urls) of the next activity for the user in the IMS-LD.
} {
template::multirow create imsld_multirow prerequisites \
- objectives \
- environments \
- activities \
- feedbacks \
- status
+ objectives \
+ environments \
+ activities \
+ feedbacks \
+ status
+
# environments
set environments_titles ""
set environments_files ""
+ # variable which controls the number of tabs for the activity structures
+ set tab_structures 1
+
db_1row get_ismld_info {
select imsld_id
from imsld_imsldsi
@@ -1903,137 +1956,123 @@
set objectives ""
if { [llength $objectives_list] } {
- set objectives "[lindex $objectives_list 0]
"
+ set objectives "[lindex $objectives_list 0]"
append objectives "[join [lindex $objectives_list 1] " "]"
}
if { [string length "${prerequisites}${objectives}"] } {
template::multirow append imsld_multirow $prerequisites $objectives {} {} {} {}
-
-
imsld::grant_permissions -resources_activities_list [join [list $prerequisites_list_ids $objectives_list_ids]] -user_id $user_id
}
- if { ![db_string get_last_entry {
- select count(*)
- from imsld_status_user
- where user_id = :user_id
- and imsld_id = :imsld_id
- }] } {
+ if { ![db_string get_last_entry { *SQL* }] } {
# special case: the user has no entry, the ims-ld hasn't started yet for that user
set first_p 1
- db_1row get_first_role_part {
- select irp.role_part_id
- from cr_items cr0, cr_items cr1, cr_items cr2, imsld_methods im, imsld_plays ip, imsld_acts ia, imsld_role_parts irp
- where im.imsld_id = :imsld_item_id
- and ip.method_id = cr0.item_id
- and cr0.live_revision = im.method_id
- and ia.play_id = cr1.item_id
- and cr1.live_revision = ip.play_id
- and irp.act_id = cr2.item_id
- and cr2.live_revision = ia.act_id
- and content_revision__is_live(irp.role_part_id) = 't'
- and ip.sort_order = (select min(ip2.sort_order) from imsld_plays ip2 where ip2.method_id = cr0.item_id)
- and ia.sort_order = (select min(ia2.sort_order) from imsld_acts ia2 where ia2.play_id = cr1.item_id)
- and irp.sort_order = (select min(irp2.sort_order) from imsld_role_parts irp2 where irp2.act_id = cr2.item_id)
- }
+ db_1row get_first_role_part { *SQL* }
} else {
+ ns_log notice "uno"
+
# get the completed activities in order to display them
# save the last one (the last role_part_id of THE LAST completed activity) because we will use it latter
# JOPEZ: needed to split the db_foreach from the body because of db pools
- foreach completed_activity [db_list_of_lists completed_activity { *SQL* }] {
- set related_id [lindex $completed_activity 0]
- set role_part_id [lindex $completed_activity 1]
- set type [lindex $completed_activity 2]
- set sort_order [lindex $completed_activity 3]
- set act_id [lindex $completed_activity 4]
+ foreach marked_activity [db_list_of_lists marked_activity { *SQL* }] {
+ set related_id [lindex $marked_activity 0]
+ set role_part_id [lindex $marked_activity 1]
+ set type [lindex $marked_activity 2]
+ set sort_order [lindex $marked_activity 3]
+ set act_id [lindex $marked_activity 4]
+ set status [lindex $marked_activity 5]
# environments
set environment_list [list]
set environments ""
switch $type {
learning {
- db_1row get_learning_activity_info {
- select coalesce(title,identifier) as activity_title,
- item_id as activity_item_id
- from imsld_learning_activitiesi
- where activity_id = :completed_id
- }
- set activities_list [imsld::process_learning_activity -activity_item_id $activity_item_id]
-
- set prerequisites ""
- if { [llength [lindex $activities_list 0]] } {
- set prerequisites "[lindex [lindex $activities_list 0] 0]
"
- append prerequisites "[join [lindex [lindex $activities_list 0] 1] " "]"
- }
- set objectives ""
- if { [llength [lindex $activities_list 1]] } {
- set objectives "[lindex [lindex $activities_list 1] 0]
"
- append objectives "[join [lindex [lindex $activities_list 1] 1] " "]"
- }
- if { [llength [lindex $activities_list 2]] } {
- set environments "[lindex [lindex $activities_list 2] 0]
"
- append environments "[join [lindex [lindex $activities_list 2] 1] " "] "
- append environments "[join [lindex [lindex $activities_list 2] 2] " "] "
- append environments "[join [lindex [lindex $activities_list 2] 3] " "]"
- }
-
- set activities "$activity_title
[join [lindex $activities_list 3] " "]"
-
- set feedbacks ""
- if { [llength [lindex $activities_list 4]] } {
- set feedbacks "[lindex [lindex $activities_list 4] 0]
"
- append feedbacks "[join [lindex [lindex $activities_list 4] 1] " "]"
- }
-
- set resources_activities_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
- foreach resource_activity [join $resources_activities_list] {
-
+ if { [string eq $status "finished"] } {
+ db_1row get_learning_activity_info {
+ select coalesce(title,identifier) as activity_title,
+ item_id as activity_item_id
+ from imsld_learning_activitiesi
+ where activity_id = :completed_id
+ }
+ set activities_list [imsld::process_learning_activity -activity_item_id $activity_item_id]
-#assessment must have an extra feedback item
- if {[db_0or1row is_assessment {} ] } {
- db_1row get_as_site_node {}
- set as_feedback_url "[site_node::get_url -node_id $node_id][export_vars -base sessions {assessment_id $assessment_id}]"
- set as_feedback_link ""
- append feedbacks $as_feedback_link
- }
- }
+ set prerequisites ""
+ if { [llength [lindex $activities_list 0]] } {
+ set prerequisites "[lindex [lindex $activities_list 0] 0]
"
+ append prerequisites "[join [lindex [lindex $activities_list 0] 1] " "]"
+ }
+ set objectives ""
+ if { [llength [lindex $activities_list 1]] } {
+ set objectives "[lindex [lindex $activities_list 1] 0]
"
+ append objectives "[join [lindex [lindex $activities_list 1] 1] " "]"
+ }
+ if { [llength [lindex $activities_list 2]] } {
+ set environments "[lindex [lindex $activities_list 2] 0]
"
+ append environments "[join [lindex [lindex $activities_list 2] 1] " "] "
+ append environments "[join [lindex [lindex $activities_list 2] 2] " "] "
+ append environments "[join [lindex [lindex $activities_list 2] 3] " "]"
+ }
+
+ set activities "