Exemple #1
0
 function execute(VF_Schema $schema)
 {
     $this->legacyNumericSearch = (bool) $this->getConfig()->search->legacyNumericSearch;
     $this->schema = $schema;
     $levels = $schema->getLevels();
     $c = count($levels);
     $levelFinder = new VF_Level_Finder($schema);
     /** @var VF_Level_Finder|VF_Level_Finder_Selector $levelFinder */
     if (isset($_GET['front'])) {
         $product = isset($_GET['product']) ? $_GET['product'] : null;
         if (!$this->legacyNumericSearch) {
             if ($this->shouldListAll()) {
                 $levelsToSelect = array($this->requestLevel());
                 $where = $this->requestLevels();
                 $vehicleFinder = new VF_Vehicle_Finder($schema);
                 $vehicles = $vehicleFinder->findDistinct($levelsToSelect, $where);
                 $children = array();
                 foreach ($vehicles as $vehicle) {
                     /** @var VF_Vehicle $vehicle */
                     array_push($children, $vehicle->getLevel($this->requestLevel()));
                 }
             } else {
                 $children = $levelFinder->listInUseByTitle(new VF_Level($this->requestLevel()), $this->requestLevels(), $product);
             }
         } else {
             if ($this->shouldListAll()) {
                 $children = $levelFinder->listAll(new VF_Level($this->requestLevel()), $this->requestLevels(), $product);
             } else {
                 $children = $levelFinder->listInUse(new VF_Level($this->requestLevel()), $this->requestLevels(), $product);
             }
         }
     } else {
         $children = $levelFinder->listAll($this->requestLevel(), $this->requestLevels());
     }
     echo $this->renderChildren($children);
 }