src/Controller/Frontend/HomepageController.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Frontend;
  3. use App\Controller\Base\BaseController;
  4. use App\Entity\TInfografik;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Kematjaya\Breadcrumb\Lib\Builder as BreacrumbBuilder;
  7. use App\Repository\MSektorRepository;
  8. use App\Repository\TDivRepository;
  9. use App\Repository\TPublikasiRepository;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Sonata\SeoBundle\Seo\SeoPageInterface;
  12. class HomepageController extends BaseController
  13. {
  14.     /**
  15.      * @Route("/", name="homepage")
  16.      */
  17.     public function index(SeoPageInterface $seoPageMSektorRepository $MSektorRepoTDivRepository $TDivRepoTPublikasiRepository $TPubRepo)
  18.     {
  19.         $seoPage->addTitlePrefix(
  20.             "Homepage"
  21.         );
  22.         
  23.         $infografik $this->getDoctrine()->getRepository(TInfografik::class);
  24.         $infografik $infografik->findAll();
  25.         $total_infografik count($infografik);
  26.         
  27.         $total_div $TDivRepo->getTDiv();
  28.         $total_div count($total_div);
  29.         $total_pub $TPubRepo->getPub();
  30.         $total_pub count($total_pub);
  31.         $sektoral $MSektorRepo->findAll();
  32.         $total_sektoral count($sektoral);
  33.         $highlight $this->highlight();
  34.         // dump($this->dashboardSearch(''));exit;
  35.         // dump($highlight);exit;
  36.         return $this->render('frontend/index.html.twig', [
  37.             'header_kategori' => $this->getHeaderKategori(),
  38.             'total_div' => $total_div,
  39.             'total_infografik' => $total_infografik,
  40.             'total_pub' => $total_pub,
  41.             'total_sektoral' => $total_sektoral,
  42.             'highlight' => $highlight
  43.         ]);
  44.     }
  45.     /**
  46.      * @Route("/gsearch.html",name="gsearch", methods={"POST", "GET"})
  47.      */
  48.     public function gsearch(Request $request){
  49.         $key $request->get('key');
  50.         $data $this->dashboardSearch($key);
  51.         $dataset = array();
  52.         foreach($data as $dt)
  53.         {
  54.             $dataset[] = array(
  55.                 'id' => $dt['id'],
  56.                 'judul' => str_ireplace($key"<strong>" .$key"</strong>" ,$dt['judul']),
  57.                 'judulx' => $dt['judul'],
  58.                 'tipe' => $dt['tipe']
  59.             );
  60.             // break;
  61.         }
  62.         return $this->json($dataset);
  63.     }
  64.     /**
  65.      * @Route("/pencarian.html",name="search", methods={"POST", "GET"})
  66.      */
  67.     public function search(Request $request)
  68.     {
  69.         $key $request->get('key');
  70.         $data $this->dashboardSearch($key);
  71.         // dump($data);exit;
  72.         return $this->render('frontend/search.html.twig', [
  73.             'data' => $data,
  74.             'header_kategori' => $this->getHeaderKategori(),
  75.         ]);
  76.     }
  77.     /**
  78.      * @Route("/visualisasi", name="visualisasi", methods={"POST", "GET"})
  79.      */
  80.     public function visualisasi(Request $request)
  81.     {
  82.         return $this->render('/frontend/visualisasi/index.html.twig', [
  83.             
  84.         ]);
  85.     }
  86. }