events_user_contributions

one of the documented procedures in this installation of the ACS
Usage:
events_user_contributions   db   user_id   purpose
What it does:
Returns list of events for which this user has registered
Defined in: /web/philip/tcl/events-defs.tcl

Source code:



    set db_sub [ns_db gethandle subquery]

    set selection [ns_db select $db "
    select r.reg_id,
    to_char(r.reg_date, 'fmMonth DD, YYYY') as reg_date,
    e.event_id, e.venue_id, e.available_p,
    e.reg_deadline - sysdate as event_available,
    to_char(e.start_time, 'fmDay, fmMonth DD, YYYY') as event_start,
    a.short_name
    from events_reg_not_canceled r, events_prices p, events_events e,
    events_activities a
    where r.user_id = $user_id
    and p.price_id = r.price_id
    and e.event_id = p.event_id
    and a.activity_id = e.activity_id
    order by r.reg_date desc"]
    
    set items ""
    while { [ns_db getrow $db $selection] } {
	set_variables_after_query

	if { $purpose == "site_admin" } {
	    append items "<li>
	    $reg_date:
	    <a href=\"/events/admin/reg-view?[export_url_vars reg_id]\">
	    $short_name in [events_pretty_venue $db_sub $venue_id] on 
	    $event_start
	    </a>\n"
	} elseif {$event_available > 0 && $available_p == "t"} {
	    #only link to the event if you can still see its order form
	    append items "
	    <li>
	    <a href=\"/events/event-info?[export_url_vars event_id]\">
	    $reg_date:
	    $short_name in [events_pretty_venue $db_sub $venue_id] on 
	    $event_start</a>\n"
	} else {
	    append items "
	    <li>
	    $reg_date:
	    $short_name in [events_pretty_venue $db_sub $venue_id] on 
	    $event_start\n"
	}
    }

    ns_db releasehandle $db_sub

    if [empty_string_p $items] {
	return [list]
    } else {
	return [list 0 "Event Registrations" "<ul>\n\n$items\n\n</ul>"]
    }


philg@mit.edu