ad_user_class_description selectionWhat it does:
Takes an ns_set of key/value pairs and produces a human-readable description of the class of users specified.Defined in: /web/philip/packages/acs-core/admin-procs.tcl
Source code:
set db [ns_db gethandle subquery] set clauses [list] set pretty_description "" # because we named our arg "selection", we can use this magic # utility procedure to set everything as a local var set_variables_after_query foreach criteria [ad_user_class_parameters] { if { [info exists $criteria] && ![empty_string_p [set $criteria]] } { switch $criteria { "category_id" { set pretty_category [database_to_tcl_string $db "select category from categories where category_id = $category_id"] lappend clauses "said they were interested in $pretty_category" } "country_code" { set pretty_country [database_to_tcl_string $db "select country_name from country_codes where iso = '$country_code'"] lappend clauses "told us that they live in $pretty_country" } "usps_abbrev" { set pretty_state [database_to_tcl_string $db "select state_name from states where usps_abbrev = '$usps_abbrev'"] lappend clauses "told us that they live in $pretty_state" } "intranet_user_p" { lappend clauses "are an employee" } "group_id" { set group_name [database_to_tcl_string $db "select group_name from user_groups where group_id=$group_id"] lappend clauses "are a member of $group_name" } "last_name_starts_with" { lappend clauses "have a last name starting with $last_name_starts_with" } "email_starts_with" { lappend clauses "have an email address starting with $email_starts_with" } "expensive" { lappend clauses "have accumulated unpaid charges of more than [ad_parameter ExpensiveThreshold "member-value"]" } "user_state" { lappend clauses "have user state of $user_state" } "sex" { lappend clauses "are $sex." } "age_above_years" { lappend clauses "is older than $age_above_years years" } "age_below_years" { lappend clauses "is younger than $age_below_years years" } "registration_during_month" { set pretty_during_month [database_to_tcl_string $db "select to_char(to_date('$registration_during_month','YYYYMM'),'fmMonth YYYY') from dual"] lappend clauses "registered during $pretty_during_month" } "registration_before_days" { lappend clauses "registered over $registration_before_days days ago" } "registration_after_days" { lappend clauses "registered in the last $registration_after_days days" } "registration_after_date" { lappend clauses "registered on or after $registration_after_date" } "last_login_before_days" { lappend clauses "have not visited the site in $last_login_before_days days" } "last_login_after_days" { lappend clauses "have not visited the site in $last_login_after_days days" } "last_login_equals_days" { if { $last_login_equals_days == 1 } { lappend clauses "visited the site exactly 1 day ago" } else { lappend clauses "visited the site exactly $last_login_equals_days days ago" } } "number_of_visits_below" { lappend clauses "have visited less than $number_visits_below times" } "number_of_visits_above" { lappend clauses "have visited more than $number_visits_above times" } "user_class_id" { set pretty_class_name [database_to_tcl_string $db "select name from user_classes where user_class_id = $user_class_id"] lappend clauses "are in the user class $pretty_class_name" } "sql_post_select" { lappend clauses "are returned by \"<i>select users(*) from $sql_post_select</i>" } "crm_state" { lappend clauses "are in the customer state \"$crm_state\"" } "curriculum_elements_completed" { if { $curriculum_elements_completed == 1 } { lappend clauses "who have completed exactly $curriculum_elements_completed curriculum element" } else { lappend clauses "who have completed exactly $curriculum_elements_completed curriculum elements" } } } if { [info exists combine_method] && $combine_method == "or" } { set pretty_description [join $clauses " or "] } else { set pretty_description [join $clauses " and "] } } } ns_db releasehandle $db return $pretty_description