ad_user_class_description (public, deprecated)

 ad_user_class_description set_id

Defined in packages/acs-tcl/tcl/admin-procs.tcl

Deprecated. Invoking this procedure generates a warning.

Takes an ns_set of key/value pairs and produces a human-readable description of the class of users specified. DEPRECATED: this was a private api, used nowhere in upstream code. I do not delete it for reference.

Parameters:
set_id (required)
See Also:
  • nothing

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) ad_ns_set_to_tcl_vars ad_ns_set_to_tcl_vars (public, deprecated) ad_user_class_parameters ad_user_class_parameters (private) db_string db_string (public) parameter::get parameter::get (public) ad_user_class_description ad_user_class_description ad_user_class_description->ad_log_deprecated ad_user_class_description->ad_ns_set_to_tcl_vars ad_user_class_description->ad_user_class_parameters ad_user_class_description->db_string ad_user_class_description->parameter::get

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc ad_user_class_description
    set clauses [list]
    set pretty_description ""

    # turn all the parameters in the ns_set into Tcl vars
    ad_ns_set_to_tcl_vars -duplicates fail $set_id

    # All the SQL statements are named after the criteria name (e.g. category_id)

    foreach criteria [ad_user_class_parameters] {
        if { [info exists $criteria] && [set $criteria] ne "" } {

            switch -- $criteria {
                "category_id" {
                    set pretty_category [db_string $criteria {
                        select category from categories where category_id = :category_id
                    } ]
                    lappend clauses "said they were interested in $pretty_category"
                }
                "country_code" {
                    set pretty_country [db_string $criteria {
                        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 [db_string $criteria {
                        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 [db_string $criteria {
                        select group_name from 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 [parameter::get -parameter ExpensiveThreshold]"
                }
                "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 [db_string $criteria {
                        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 [db_string $criteria {
                        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 eq "or" } {
        set pretty_description [join $clauses " or "]
    } else {
        set pretty_description [join $clauses " and "]
    }

    return $pretty_description
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
<fullquery name="ad_user_class_description.category_id">
    <querytext>
        select category from categories where category_id = :category_id

      </querytext>
</fullquery>

<fullquery name="ad_user_class_description.country_code">
    <querytext>

        select country_name from country_codes where iso = :country_code

      </querytext>
</fullquery>

<fullquery name="ad_user_class_description.usps_abbrev">
    <querytext>

        select state_name from states where usps_abbrev = :usps_abbrev

      </querytext>
</fullquery>

<fullquery name="ad_user_class_description.group_id">
    <querytext>

        select group_name from groups where group_id = :group_id

      </querytext>
</fullquery>

<fullquery name="ad_user_class_description.registration_during_month">
    <querytext>

        select to_char(to_date(:registration_during_month,'YYYYMM'),'fmMonth YYYY') from dual

      </querytext>
</fullquery>

<fullquery name="ad_user_class_description.user_class_id">
    <querytext>

        select name from user_classes where user_class_id = :user_class_id

      </querytext>
</fullquery>
packages/acs-tcl/tcl/admin-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: