/** * Return array containing information about all hierarchies, including their root_id's * For non-adhoc hierarchies such as places, this call returns the contents of the place_hierarchies list * with some extra information such as the # of top-level items in each hierarchy. * * For an ad-hoc hierarchy like that of a tour stop, there is only ever one hierarchy to display - that of the current stop. * So for adhoc hierarchies we just return a single entry corresponding to the root of the current tour stop hierarchy */ public function getHierarchyList($pb_dummy = false) { $vn_pk = $this->getPrimaryKey(); if (!$vn_pk) { return null; } // have to load a row first $vs_template = $this->getAppConfig()->get('ca_tour_stops_hierarchy_browser_display_settings'); if (!$vs_template) { $vs_template = "^ca_tour_stops.preferred_labels.name"; } $vs_label = $this->getLabelForDisplay(false); $vs_hier_fld = $this->getProperty('HIERARCHY_ID_FLD'); $vs_parent_fld = $this->getProperty('PARENT_ID_FLD'); $vn_hier_id = $this->get($vs_hier_fld); if ($this->get($vs_parent_fld)) { // currently loaded row is not the root so get the root $va_ancestors = $this->getHierarchyAncestors(); if (!is_array($va_ancestors) || sizeof($va_ancestors) == 0) { return null; } $t_stop = new ca_tour_stops($va_ancestors[0]); } else { $t_stop =& $this; } $va_children = $t_stop->getHierarchyChildren(null, array('idsOnly' => true)); $va_stop_hierarchy_root = array($t_stop->get($vs_hier_fld) => array('item_id' => $vn_pk, 'name' => $vs_name = caProcessTemplateForIDs($vs_template, 'ca_tour_stops', array($vn_pk)), 'hierarchy_id' => $vn_hier_id, 'children' => sizeof($va_children))); return $va_stop_hierarchy_root; }