src/CorporateTrainingBundle/Controller/HomeDefaultController.php line 12

Open in your IDE?
  1. <?php
  2. namespace CorporateTrainingBundle\Controller;
  3. use AppBundle\Common\ArrayToolkit;
  4. use AppBundle\Controller\BaseController;
  5. use CorporateTrainingBundle\Biz\HomePage\Service\HomePageService;
  6. use CorporateTrainingBundle\Biz\IndustryTemplate\Service\IndustryTemplateSyncRecordService;
  7. class HomeDefaultController extends BaseController
  8. {
  9.     public function indexAction()
  10.     {
  11.         $homePageComponents $this->getHomePageService()->findComponentOrderBySeqAsc();
  12.         $config $this->getHomePageService()->getHomePageComponentConfig();
  13.         $blocks = !empty($config['blocks']) ? $config['blocks'] : [];
  14.         $blockCodes ArrayToolkit::column($blocks'code');
  15.         return $this->render(
  16.             $this->isMobileClient() ? 'default/index-mobile.html.twig' 'default/index.html.twig',
  17.             [
  18.                 'homePageComponents' => $homePageComponents,
  19.                 'blockCodes' => $blockCodes,
  20.                 'editing' => false,
  21.                 'time' => time(),
  22.                 'isShowIndustryTemp' => $this->getIndustryTemplateSyncRecordService()->canSyncTemplate(),
  23.             ]
  24.         );
  25.     }
  26.     /**
  27.      * @return HomePageService
  28.      */
  29.     protected function getHomePageService()
  30.     {
  31.         return $this->createService('HomePage:HomePageService');
  32.     }
  33.     /**
  34.      * @return IndustryTemplateSyncRecordService
  35.      */
  36.     protected function getIndustryTemplateSyncRecordService()
  37.     {
  38.         return $this->getBiz()->service('CorporateTrainingBundle:IndustryTemplate:IndustryTemplateSyncRecordService');
  39.     }
  40. }