/** * Returns name of hierarchy for currently loaded row or, if specified, row identified by optional $pn_id parameter */ public function getHierarchyName($pn_id = null) { if (!$pn_id) { $pn_id = $this->getPrimaryKey(); } $va_ancestors = $this->getHierarchyAncestors($pn_id, array('idsOnly' => true)); if (is_array($va_ancestors) && sizeof($va_ancestors)) { $vn_parent_id = array_pop($va_ancestors); $t_stop = new ca_tour_stops($vn_parent_id); return $t_stop->getLabelForDisplay(false); } else { if ($pn_id == $this->getPrimaryKey()) { return $this->getLabelForDisplay(true); } else { $t_stop = new ca_tour_stops($pn_id); return $t_stop->getLabelForDisplay(false); } } }