53 lines
1.4 KiB
PHP
Executable File
53 lines
1.4 KiB
PHP
Executable File
|
|
<?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->getAllTriGeometriesByBrand($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";
|
|
}
|
|
|
|
|
|
?>
|
|
|