xowiki::FormPage proc get_all_children (public)
xowiki::FormPageget_all_children -folder_id folder_id \ [ -publish_status publish_status ] [ -object_types object_types ] \ [ -extra_where_clause extra_where_clause ] \ [ -include_child_folders include_child_folders ] \ [ -initialize initialize ]
Defined in /var/www/openacs/packages/xowiki/tcl/xowiki-procs.tcl
Collect matching children from a folder and its inherited folders.
- Switches:
- -folder_id (required)
- Root folder item ID.
- -publish_status (optional, defaults to
"ready")- Publication status filter.
- -object_types (optional, defaults to
"::xowiki::Page ::xowiki::Form ::xowiki::FormPage")- Content types to include.
- -extra_where_clause (optional, defaults to
"1=1")- Additional SQL condition.
- -include_child_folders (optional, defaults to
"none")- Whether to include child folders in the search.
- -initialize (optional, defaults to
"true")- Whether to initialize the returned objects.
- Returns:
- An ordered composite of matching children.
- Testcases:
- includelet_childresources
Source code: set folder [::xo::db::CrClass get_instance_from_db -item_id $folder_id -revision_id 0] set package_id [$folder package_id] set publish_status_clause [::xowiki::Includelet publish_status_clause $publish_status] set result [::xo::OrderedComposite new -destroy_on_cleanup] $result set folder_ids "" set list_of_folders [list $folder_id] set inherit_folders [FormPage get_super_folders $package_id $folder_id] #:log inherit_folders=$inherit_folders foreach item_ref $inherit_folders { set folder [::xo::cc cache [list ::$package_id get_page_from_item_ref $item_ref]] if {$folder eq ""} { ad_log error "Could not resolve parameter folder page '$item_ref' of FormPage [self]." } else { lappend list_of_folders [$folder item_id] } } if {$include_child_folders eq "direct"} { # # Get all children of the current folder on the first level and # append it to the list_of_folders. # set folder_form [::$package_id instantiate_forms -forms en:folder.form] set child_folders [xo::dc list -prepare integer,integer get_child_folders { select item_id from xowiki_form_instance_item_index where parent_id = :folder_id and page_template = :folder_form }] foreach f $child_folders { ::xo::db::CrClass get_instance_from_db -item_id $f } lappend list_of_folders {*}$child_folders } $result set folder_ids $list_of_folders foreach folder_id $list_of_folders { foreach object_type $object_types { set attributes [list revision_id creation_user title parent_id page_order "to_char(last_modified,'YYYY-MM-DD HH24:MI') as last_modified" ] set base_table [$object_type set table_name]i if {$object_type eq "::xowiki::FormPage"} { set attributes "bt.* $attributes" } set items [$object_type get_instances_from_db -folder_id $folder_id -with_subtypes false -initialize $initialize -select_attributes $attributes -where_clause "$extra_where_clause $publish_status_clause" -base_table $base_table] foreach i [$items children] { $result add $i } } } return $resultXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)