public function getCategoryName() { if ($name = RelationshipCategoryTable::getNameById($this->category_id)) { return $name; } if ($category = $this->getCategory()) { return $category->name; } return null; }
<?php include_partial('relationship/header', array('relationship' => $relationship, 'show_actions' => true)); ?> <?php include_partial('relationship/rightcol', array('relationship' => $relationship)); ?> <?php if (!cache('main', 86400)) { ?> <div class="relationship-main"> <?php include_partial('relationship/' . strtolower(RelationshipCategoryTable::getNameById($relationship['category_id'])) . 'view', array('relationship' => $relationship, 'current' => $current)); ?> </div> <?php cache_save(); }
static function getNameByRelationshipAndEntities($relationship, $entity1, $entity2) { //return generic name if components are missing if (!$entity1['name'] || !$entity2['name'] || !$relationship['category_id']) { return 'Relationship'; } $categoryName = RelationshipCategoryTable::getNameById($relationship['category_id']); return $categoryName . ': ' . $entity1['name'] . ', ' . $entity2['name']; }