curriculum_user_contributions db user_id purposeWhat it does:
Returns list items, one for each curriculum postingDefined in: /web/philip/tcl/curriculum.tcl
Source code:
if { $purpose != "site_admin" } {
# we don't show user tracking data to other users!
return [list]
}
# we have to figure out whether this person is
# (a) finished
# (b) hasn't started, or
# (c) in between
# this query will pull the curriculum out in order that hte
# user viewed the stuff, with the unviewed rows at the end
set selection [ns_db select $db "select url, one_line_description, completion_date
from curriculum, (select curriculum_element_id, completion_date
from user_curriculum_map
where user_id = $user_id) ucm
where curriculum.curriculum_element_id = ucm.curriculum_element_id(+)
order by completion_date asc"]
set found_uncompleted_element_p 0
set found_completed_element_p 0
while { [ns_db getrow $db $selection] } {
set_variables_after_query
if ![empty_string_p $completion_date] {
set found_completed_element_p 1
append items "<li>[util_AnsiDatetoPrettyDate $completion_date]: <a href=\"$url\">$one_line_description</a>\n"
} else {
set found_uncompleted_element_p 1
append items "<li>not completed: <a href=\"$url\">$one_line_description</a>\n"
}
}
if [empty_string_p $items] {
return [list]
} elseif { !$found_uncompleted_element_p && $found_completed_element_p } {
# we have done them all
return [list 0 "Curriculum Progress" "<ul><li>completed curriculum</ul>"]
} elseif { $found_uncompleted_element_p && !$found_completed_element_p } {
# we haven't done any!
return [list 0 "Curriculum Progress" "<ul><li>hasn't started curriculum</ul>"]
} else {
return [list 0 "Curriculum Progress" "<ul>\n\n$items\n\n</ul>"]
}