Fifth pass at adding key files
This commit is contained in:
		
							
								
								
									
										50
									
								
								site/stackreach/road.php
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										50
									
								
								site/stackreach/road.php
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
<?php
 | 
			
		||||
include_once './models/services/Database.php';
 | 
			
		||||
include_once './models/services/FrameService.php';
 | 
			
		||||
include_once './models/services/ModelService.php';
 | 
			
		||||
include_once './models/services/BrandService.php';
 | 
			
		||||
include_once './models/services/GeometryService.php';
 | 
			
		||||
include_once './libs/Smarty.class.php';
 | 
			
		||||
 | 
			
		||||
try
 | 
			
		||||
{
 | 
			
		||||
    $brandService = new BrandService();
 | 
			
		||||
    $brands = $brandService->getAllBrands();
 | 
			
		||||
 | 
			
		||||
    $brandMap = array();
 | 
			
		||||
 | 
			
		||||
    foreach ($brands as $brand)
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        $geometryService = new GeometryService();
 | 
			
		||||
        $geometries = $geometryService->getAllRoadGeometriesByBrand($brand->id);
 | 
			
		||||
 | 
			
		||||
        foreach ($geometries as $geometry)
 | 
			
		||||
        {
 | 
			
		||||
            $modelService = new ModelService();
 | 
			
		||||
            $brandMap[$brand->name][$geometry->name]['models'] = $modelService->getAllModelsByGeometry($geometry->id);
 | 
			
		||||
 | 
			
		||||
            $frameService = new FrameService();
 | 
			
		||||
            $frames = $frameService->getAllFramesByGeometry($geometry->id);
 | 
			
		||||
 | 
			
		||||
            if ($frames === null) { header('location:add_frame.php');}
 | 
			
		||||
 | 
			
		||||
            foreach ($frames as $frame)
 | 
			
		||||
            {
 | 
			
		||||
                $brandMap[$brand->name][$geometry->name]['geometries'][] = $frame;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $smarty = new Smarty;
 | 
			
		||||
    $smarty->assign('brandMap', $brandMap);
 | 
			
		||||
    $smarty->display('views/index.tpl');
 | 
			
		||||
 | 
			
		||||
} 
 | 
			
		||||
catch (Exception $e) 
 | 
			
		||||
{
 | 
			
		||||
    echo 'Caught exception: ',  $e->getMessage(), "\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user