etp::get_content_items (public)
etp::get_content_items [ -orderby orderby ] [ -limit limit ] \ [ -where where ] [ -package_id package_id ] \ [ -result_name result_name ] [ args... ]
Defined in packages/edit-this-page/tcl/etp-procs.tcl
- Switches:
- -orderby (optional)
- -limit (optional)
- -where (optional)
- -package_id (optional)
- -result_name (optional, defaults to
"content_items"
)- Author:
- Luke Pond
- Created:
- 2001-06-10
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set content_type [etp::get_content_type] if {$orderby eq ""} { set orderby [db_map gci_orderby] } if {$limit ne ""} { set limit_clause "limit $limit" } else { set limit_clause "" } if {$where ne ""} { set extra_where_clauses $where } else { set extra_where_clauses [db_map gci_where_clause] } if {$package_id eq ""} { set package_id [ad_conn package_id] } else { set app [parameter::get -package_id $package_id -parameter application -default default] set content_type [etp::get_application_param content_content_type $app] } set columns [db_map gci_columns_clause] ns_log debug "get_content_items: columns: $columns" for {set i 0} {$i < [llength $args]} {incr i} { set arg [lindex $args i] if {$arg in { item_id revision_id content publish_date }} { append columns ",\n r.$arg" } else { ns_log debug "get_content_items: extended attribute named $arg" set attr_desc [etp::get_attribute_desc $arg $content_type] if { $attr_desc ne "" } { ns_log debug "get_content_items: adding it" set lookup_sql [etp::get_attribute_lookup_sql $attr_desc] append columns ",\n $lookup_sql" } } } upvar $result_name $result_name set folder_id [etp::get_folder_id $package_id] db_multirow $result_name get_content_items ""Generic XQL file: <fullquery name="etp::get_content_items.gci_where_clause"> <querytext> 1 = 1 </querytext> </fullquery>packages/edit-this-page/tcl/etp-procs.xql
PostgreSQL XQL file: <fullquery name="etp::get_content_items.get_content_items"> <querytext> select * from (select $columns from cr_items i left join cr_revisions r on (i.live_revision = r.revision_id) where i.parent_id = :folder_id and i.name != 'index' ) attributes where $extra_where_clauses order by $orderby $limit_clause </querytext> </fullquery> <fullquery name="etp::get_content_items.gci_orderby"> <querytext> sort_order </querytext> </fullquery> <fullquery name="etp::get_content_items.gci_columns_clause"> <querytext> i.item_id, i.name, tree_sortkey as sort_order, to_char(r.publish_date, 'Mon DD, YYYY') as publish_date, (select object_type from acs_objects where object_id = i.item_id) as object_type, etp__get_relative_url(i.item_id, i.name) as url, etp__get_title(i.item_id, r.title) as title, etp__get_description(i.item_id, r.description) as description </querytext> </fullquery>packages/edit-this-page/tcl/etp-procs-postgresql.xql
Oracle XQL file: <fullquery name="etp::get_content_items.get_content_items"> <querytext> select * from (select * from ( select $columns from cr_items i, cr_revisions r where i.parent_id = :folder_id and i.name != 'index' and i.live_revision = r.revision_id(+) ) attributes where $extra_where_clauses order by $orderby) $limit_clause </querytext> </fullquery> <fullquery name="etp::get_content_items.gci_orderby"> <querytext> sort_order </querytext> </fullquery> <fullquery name="etp::get_content_items.gci_columns_clause"> <querytext> i.item_id, i.name, to_char(r.publish_date, 'Mon DD, YYYY') as publish_date, rownum as sort_order, (select object_type from acs_objects where object_id = i.item_id) as object_type, etp.get_relative_url(i.item_id, i.name) as url, etp.get_title(i.item_id, r.title) as title, etp.get_description(i.item_id, r.description) as description </querytext> </fullquery>packages/edit-this-page/tcl/etp-procs-oracle.xql