resq/src/Controller/TestController.php

85 lines
1.8 KiB
PHP

<?php
namespace App\Controller;
use Catalyst\AuthBundle\Service\ACLGenerator;
use CrEOF\Spatial\PHP\Types\Geometry\Point;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Doctrine\Common\Util\Debug;
use GuzzleHttp\Client as GuzzleClient;
use Catalyst\MenuBundle\Annotation\Menu;
use App\Entity\Outlet;
use App\Service\MapTools;
use App\Service\MotivConnector;
class TestController extends Controller
{
/**
* @Menu(selected="home")
*/
public function index(ACLGenerator $acl_gen)
{
$acl_data = $acl_gen->getACL();
error_log(print_r($acl_data, true));
return $this->render('home.html.twig');
}
/**
* @Menu(selected="home")
*/
public function testIsGranted()
{
error_log(print_r($this->isGranted('dashboard.menu'), true));
return $this->render('home.html.twig');
}
/**
* @Menu(selected="home")
*/
public function gmap()
{
return $this->render('test/map.html.twig');
}
/**
* @Menu(selected="home")
*/
public function distance(MapTools $map_tools)
{
$point = new Point(121.0495453, 14.6042567);
// $point = new Point(120.343692, 16.048560);
$res = $map_tools->getClosestOutlets($point, 10);
foreach ($res as $data)
{
error_log($data['db_distance']);
error_log($data['distance']);
error_log($data['duration']);
}
return $this->render('home.html.twig');
}
/**
* @Menu(selected="home")
*/
public function motivConnector(MotivConnector $motiv)
{
$branches = [
'ZL0133',
'ZL0033',
];
$skus = [
'ECHD26AL-SPN00-L',
'ECHD26AL-SPN00-LX',
];
$motiv->getInventory($branches, $skus);
}
}