function build_related_list($type = "base") { //type can be base, rel1 $target_list = ""; if ($type == "base") { $target_list = $this->base_bean->get_linked_beans($this->base_vardef_field, $this->rel1_bean->object_name); //Possibility exists that this is a new relationship, so capture via relationship fields if (empty($target_list)) { $target_list = search_filter_rel_info($this->base_bean, $this->rel1_bean->module_dir, $this->base_vardef_field); //end if the target list is empty } } if ($type == "rel1") { $target_list = $this->rel1_bean->get_linked_beans($this->rel1_vardef_field, $this->rel2_bean->object_name); //Possibility exists that this is a new relationship, so capture via relationship fields if (empty($target_list)) { $target_list = search_filter_rel_info($this->rel1_bean, $this->rel2_bean->module_dir, $this->rel1_vardef_field); //end if the target list is empty } } return $target_list; //end function build_related_list }
function check_rel_filter(&$focus, $secondary_array, $relationship_name, $rel_filter_array, $rel_module_type = "any") { global $beanList; $relationship_name = strtolower($relationship_name); //list is already cached from a prior secondary trigger filter if (!empty($secondary_array['cached_lists'][$relationship_name])) { $target_array =& $rel_filter_array['base']; $target_list = $secondary_array['cached_lists'][$relationship_name]; } else { //create new list $target_array =& $rel_filter_array['base']; $target_list = $focus->get_linked_beans($relationship_name, $beanList[$target_array['lhs_module']]); //Possibility exists that this is a new relationship, so capture via relationship fields if (empty($target_list)) { $target_list = search_filter_rel_info($focus, $target_array['lhs_module'], $relationship_name); //end if the target list is empty } } $all_count = count($target_list); $filtered_rel_list = setup_filter_records($target_list, $target_array); if ($rel_module_type == "all") { //compares before count and after count to makes sure 'all' records remained and none were filtered if (count($filtered_rel_list) == $all_count) { $secondary_array['results'] = true; $secondary_array['cached_lists'][$relationship_name] = $filtered_rel_list; } else { $secondary_array['results'] = false; $secondary_array['cached_lists'][$relationship_name] = $filtered_rel_list; } //if rel_module_type is all } if ($rel_module_type == "any") { if (!empty($filtered_rel_list)) { $secondary_array['results'] = true; $secondary_array['cached_lists'][$relationship_name] = $filtered_rel_list; } else { $secondary_array['results'] = false; $secondary_array['cached_lists'][$relationship_name] = $filtered_rel_list; } //if rel_module_type is any } return $secondary_array; //end function check_rel_filter }