protected function getParentTitle()
 {
     if ($this->getId() && $this->getEntity()->getPrevLevel()) {
         $entity = new VF_Level($this->getEntity()->getPrevLevel(), $this->getId());
         return $entity->getTitle();
     }
 }
Exemplo n.º 2
0
 /**
  * Check if an entity is the selected one for this 'level'
  *
  * @param VF_Level $levelObject - level to check if is selected
  *
  * @return bool if this is the one that is supposed to be currently selected
  */
 function isLevelSelected($levelObject)
 {
     if ($this->level != $this->leafLevel()) {
         return (bool) ($levelObject->getId() == $this->searchForm->getSelected($this->level));
     }
     VF_Singleton::getInstance()->setRequest($this->searchForm->getRequest());
     $currentSelection = VF_Singleton::getInstance()->vehicleSelection();
     if (false === $currentSelection) {
         return false;
     }
     if ('year_start' == $this->yearRangeAlias) {
         return (bool) ($levelObject->getTitle() == $this->earliestYearInVehicles($currentSelection));
     } else {
         if ('year_end' == $this->yearRangeAlias) {
             return (bool) ($levelObject->getTitle() == $this->latestYearInVehicles($currentSelection));
         }
     }
     $level = false;
     if (is_array($currentSelection) && count($currentSelection) == 1) {
         $firstVehicle = $currentSelection[0];
         /** @var VF_Vehicle $firstVehicle */
         $level = $firstVehicle->getLevel($this->leafLevel());
     } elseif ($currentSelection instanceof VF_Vehicle) {
         $level = $currentSelection->getLevel($this->leafLevel());
     }
     if ($level) {
         return (bool) ($levelObject->getTitle() == $level->getTitle());
     }
 }