xowiki::FormPage proc get_all_children

 xowiki::FormPage[i] get_all_children

Defined in

Partial Call Graph (max 5 caller/called nodes):
%3 test_includelet_childresources includelet_childresources (test ) xowiki::FormPage proc get_all_children xowiki::FormPage proc get_all_children test_includelet_childresources->xowiki::FormPage proc get_all_children test_xowiki xowiki (test ) test_xowiki->xowiki::FormPage proc get_all_children ad_log ad_log (public) xowiki::FormPage proc get_all_children->ad_log

Testcases:
includelet_childresources, xowiki
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 $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: