app/Customize/Twig/Extension/CustomExtension.php line 1950

Open in your IDE?
  1. <?php
  2. namespace Customize\Twig\Extension;
  3. use Customize\Entity\CacheTrait;
  4. use Customize\Service\GoodsPriceService;
  5. use Customize\Service\ReviewService;
  6. use Eccube\Entity\BaseInfo;
  7. use Eccube\Repository\BaseInfoRepository;
  8. use Eccube\Repository\PageRepository;
  9. use Lm\Engine\EC\Entity\GoodsWithRelated;
  10. use Lm\Entity\Goods;
  11. use Symfony\Component\HttpFoundation\RequestStack;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Twig\Environment as Twig;
  14. use Twig\Extension\AbstractExtension;
  15. use Twig\TwigFunction;
  16. use Twig\TwigFilter;
  17. use Symfony\Component\Security\Core\Security;
  18. use Eccube\Service\CartService;
  19. use Customize\Service\CartService as CartServiceCustomize;
  20. use Eccube\Common\EccubeConfig;
  21. use Customize\Service\CommonService;
  22. use Customize\Service\LmHelper;
  23. use Customize\Converter\DynamicConverter;
  24. use Customize\Service\RecentGoodsService;
  25. use Customize\Service\GoodsService;
  26. class CustomExtension extends AbstractExtension
  27. {
  28.     use CacheTrait;
  29.     /**
  30.      * @var Security
  31.      */
  32.     private $security;
  33.     /**
  34.      * @var CartService
  35.      */
  36.     protected $cartService;
  37.     protected $cartServiceCustomize;
  38.     protected $commonService;
  39.     /**
  40.      * @var DynamicConverter
  41.      */
  42.     protected $dynamicConverter;
  43.     const DISPLAY_ITEM_COUNT_LOW 20;
  44.     const DISPLAY_ITEM_COUNT_MID 50;
  45.     const DISPLAY_ITEM_COUNT_HI 100;
  46.     const DISPLAY_ITEM_COUNT_DEFAULT self::DISPLAY_ITEM_COUNT_MID;
  47.     /**
  48.      * @var EccubeConfig
  49.      */
  50.     protected $eccubeConfig;
  51.     /**
  52.      * @var Twig
  53.      */
  54.     protected $twig;
  55.     /**
  56.      * @var Request
  57.      */
  58.     protected $request;
  59.     /**
  60.      * @var LmHelper
  61.      */
  62.     protected $lmHelper;
  63.     /**
  64.      * @var ReviewService
  65.      */
  66.     protected $reviewService;
  67.     /**
  68.      * @var GoodsPriceService
  69.      */
  70.     private $goodsPriceService;
  71.     /**
  72.      * @var PageRepository
  73.      */
  74.     private $pageRepository;
  75.     /**
  76.      * @var BaseInfo
  77.      */
  78.     private $baseInfo;
  79.     protected $GoodsService;
  80.     public function __construct(Security         $security,
  81.                                 RequestStack     $requestStack,
  82.                                 Twig             $twig,
  83.                                 EccubeConfig     $eccubeConfig,
  84.                                 CartService      $cartService,
  85.                                 CommonService    $commonService,
  86.                                 LmHelper         $lmHelper,
  87.                                 DynamicConverter $dynamicConverter,
  88.                                 ReviewService    $reviewService,
  89.                                 GoodsPriceService $goodsPriceService,
  90.                                 PageRepository $pageRepository,
  91.                                 BaseInfoRepository $baseInfoRepository,
  92.                                 RecentGoodsService $RecentGoodsService,
  93.                                 CartServiceCustomize $cartServiceCustomize,
  94.                                 GoodsService     $goodService
  95.     )
  96.     {
  97.         $this->security $security;
  98.         $this->request $requestStack->getCurrentRequest();
  99.         $this->twig $twig;
  100.         $this->eccubeConfig $eccubeConfig;
  101.         $this->cartService $cartService;
  102.         $this->commonService $commonService;
  103.         $this->lmHelper $lmHelper;
  104.         $this->dynamicConverter $dynamicConverter;
  105.         $this->reviewService $reviewService;
  106.         $this->goodsPriceService $goodsPriceService;
  107.         $this->pageRepository $pageRepository;
  108.         $this->baseInfo $baseInfoRepository->get();
  109.         $this->RecentGoodsService $RecentGoodsService;
  110.         $this->cartServiceCustomize $cartServiceCustomize;
  111.         $this->GoodsService $goodService;
  112.     }
  113.     public function getFilters()
  114.     {
  115.         return [
  116.             new TwigFilter('header4_css', [$this'renderHeader4Css']),
  117.             new TwigFilter('check_mcMcName', [$this'checkMcName']),
  118.             new TwigFilter('display_text', [$this'displayText']),
  119.             new TwigFilter('lm_sashikomi', [$this'LM_sashikomi']),
  120.             new TwigFilter('replace_item_image_root', [$this'replaceItemImageRoot']),
  121.             new TwigFilter('lm_sashikomi_main_category', [$this'LM_displaySashikomi_mainCategory']),
  122.             new TwigFilter('slider_filter', [$this'sliderFilter']),
  123.             new TwigFilter('display_form_text', [$this'display_form_text']),
  124.         ];
  125.     }
  126.     public function getFunctions()
  127.     {
  128.         return [
  129.             new TwigFunction('formatDescriptionForEstimate', [$this'handleFormatDescriptionForEstimate']),
  130.             new TwigFunction('footer_main_category', [$this'getFooterMainCategory']),
  131.             new TwigFunction('left_fbnrs', [$this'getLeftFbnrs']),
  132.             new TwigFunction('right_fbnrs', [$this'getRightFbnrs']),
  133.             new TwigFunction('toe_messages', [$this'getToeMessages']),
  134.             new TwigFunction('message_categories_count', [$this'getMessageCategoriesCount']),
  135.             new TwigFunction('lmenu_css', [$this'getLMenuCss']),
  136.             new TwigFunction('totalDailyRanking', [$this'getTotalDailyRanking']),
  137.             new TwigFunction('topics_data', [$this'getTopics']),
  138.             new TwigFunction('get_s3_lm_doc_path', [$this'getS3LmDocPath']),
  139.             new TwigFunction('months', [$this'getMonths']),
  140.             new TwigFunction('days', [$this'getDays']),
  141.             new TwigFunction('render_category_list', [$this'renderCategoryList']),
  142.             new TwigFunction('preg_match', [$this'pregMatch']),
  143.             new TwigFunction('lm_detailLink2', [$this'LM_detailLink2']),
  144.             new TwigFunction('default_sp_other_category_pulldown_map', [$this'getDefaultSpOtherCategoryPulldownMap']),
  145.             new TwigFunction('sp_header', [$this'renderSpHeader']),
  146.             new TwigFunction('makeImageURL', [$this'makeImageURL']),
  147.             new TwigFunction('sashikomi', [$this'sashikomi']),
  148.             new TwigFunction('session_data', [$this'getSessionData']),
  149.             new TwigFunction('showGoodsLabelList', [$this'renderGoodsLabelList']),
  150.             new TwigFunction('render_product_item', [$this'renderProductItem']),
  151.             new TwigFunction('lm_category_filter', [$this'lm_category_filter']),
  152.             new TwigFunction('custom_parse_url', [$this'custom_parse_url']),
  153.             new TwigFunction('echoImageURL', [$this'echoImageURL']),
  154.             new TwigFunction('echoVirtualImages', [$this'echoVirtualImages']),
  155.             new TwigFunction('get_updated_at', [$this'get_updated_at']),
  156.             new TwigFunction('LM_displaySashikomi_detailGoods', [$this'LM_displaySashikomi_detailGoods']),
  157.             new TwigFunction('LM_insertFile', [$this'LM_insertFile']),
  158.             new TwigFunction('createGetParamater', [$this'createGetParamater']),
  159.             new TwigFunction('LM_displayTogetherBuyDetail_new3', [$this'LM_displayTogetherBuyDetail_new3']),
  160.             new TwigFunction('hoge', [$this'hoge']),
  161.             new TwigFunction('display_item_pulldown', [$this'display_item_pulldown']),
  162.             new TwigFunction('display_order_pulldown', [$this'display_order_pulldown']),
  163.             new TwigFunction('sp_common_contents_map', [$this'getCommonContentsMap']),
  164.             new TwigFunction('get_calendar_info', [$this'getCalendarInfo']),
  165.             new TwigFunction('get_holiday_info', [$this'getHolidayInfo']),
  166.             new TwigFunction('you_may_also_like', [$this'getYouMayAlsoLike']),
  167.             new TwigFunction('get_koe_count', [$this'getKoeCount']),
  168.             new TwigFunction('get_category_order_type', [$this'getCategoryOrderType']),
  169.             new  TwigFunction('isShowSpHeader', [$this'isShowSpHeader']),
  170.             new  TwigFunction('showSizeTable', [$this'getSizeTable']),
  171.         ];
  172.     }
  173.     public function handleFormatDescriptionForEstimate(string $text) {
  174.         if (empty($text)) {
  175.             return "";
  176.         }
  177.         $result "";
  178.         $text preg_replace('/\s+/'' '$text);
  179.         $lines explode('・'$text);
  180.         $step 1;
  181.         if (in_array('多色向き/写真等 '$lines)) {
  182.             $step 0;
  183.         }
  184.         for ($i $step$i count($lines); $i++) {
  185.             $result .= '・' $lines[$i] . "<br />";
  186.         }
  187.         return $result;
  188.     }
  189.     public function renderHeader4Css($uri)
  190.     {
  191.         $uri $_SERVER['REQUEST_URI'];
  192.         if (preg_match("/^\/polo\//"$uri)) echo "#header-menu-1-1 { background-position: -108px 0 !important; }";
  193.         if (preg_match("/^\/shirt\//"$uri) and !preg_match("/^\/shirt\/aloha\//"$uri)) echo "#header-menu-1-2 { background-position: -108px -106px !important; }";
  194.         if (preg_match("/^\/tshirt\//"$uri)) echo "#header-menu-1-3 { background-position: -108px -212px !important; }";
  195.         if (preg_match("/^\/staff\//"$uri)) echo "#header-menu-1-4 { background-position: -108px -318px !important; }";
  196.         if (preg_match("/^\/vest\//"$uri)) echo "#header-menu-1-5 { background-position: -108px -424px !important; }";
  197.         if (preg_match("/^\/warm\//"$uri)) echo "#header-menu-1-6 { background-position: -108px -530px !important; }";
  198.         if (preg_match("/^\/sweat\//"$uri)) echo "#header-menu-1-7 { background-position: -108px -636px !important; }";
  199.         if (preg_match("/^\/pants\//"$uri)) echo "#header-menu-1-8 { background-position: -108px -742px !important; }";
  200.         if (preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#header-menu-1-9 { background-position: -108px -848px !important; }";
  201.         if (preg_match("/^\/apron\//"$uri)) echo "#header-menu-2-1 { background-position: -108px -27px !important; }";
  202.         if (preg_match("/^\/shirt\/aloha\//"$uri)) echo "#header-menu-2-2 { background-position: -108px -133px !important; }";
  203.         if (preg_match("/^\/happi\//"$uri)) echo "#header-menu-2-3 { background-position: -108px -239px !important; }";
  204.         if (preg_match("/^\/cap\//"$uri)) echo "#header-menu-2-4 { background-position: -108px -345px !important; }";
  205.         if (preg_match("/^\/overall\//"$uri)) echo "#header-menu-2-5 { background-position: -108px -451px !important; }";
  206.         if (preg_match("/^\/anzengutsu\//"$uri)) echo "#header-menu-2-6 { background-position: -108px -557px !important; }";
  207.         if (preg_match("/^\/towel\//"$uri)) echo "#header-menu-2-7 { background-position: -108px -663px !important; }";
  208.         if (preg_match("/^\/scrub\//"$uri)) echo "#header-menu-2-8 { background-position: -108px -769px !important; }";
  209.         if (preg_match("/^\/bag\//"$uri)) echo "#header-menu-2-9 { background-position: -108px -875px !important; }";
  210.         if (preg_match("/^\/work\//"$uri)) echo "#header-menu-3-1 { background-position: -108px -54px !important; }";
  211.         if (preg_match("/^\/jimufuku\//"$uri)) echo "#header-menu-3-2 { background-position: -108px -160px !important; }";
  212.         if (preg_match("/^\/hakui\//"$uri) and !preg_match("/^\/hakui\/scrub\//"$uri)) echo "#header-menu-3-3 { background-position: -108px -266px !important; }";
  213.         if (preg_match("/^\/food-uniform\//"$uri) and !preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#header-menu-3-4 { background-position: -108px -372px !important; }";
  214.         if (preg_match("/^\/esthe-uniform\//"$uri) and !preg_match("/^\/towel\//"$uri)) echo "#header-menu-3-5 { background-position: -108px -478px !important; }";
  215.         if (preg_match("/^\/election-item\//"$uri)) echo "#header-menu-3-6 { background-position: -108px -584px !important; }";
  216.         if (preg_match("/^\/care-wear\//"$uri)) echo "#header-menu-3-7 { background-position: -108px -690px !important; }";
  217.         if (preg_match("/^\/patrol\//"$uri)) echo "#header-menu-3-8 { background-position: -108px -796px !important; }";
  218.         if (preg_match("/^\/food-uniform\/formal-vest\//"$uri)) echo "#header-menu-3-9 { background-position: -108px -902px !important; }";
  219.         if (preg_match("/^\/guide\//"$uri) and !preg_match("/^\/guide\/print-shurui\//"$uri) and !preg_match("/^\/guide\/price-silk\//"$uri) and !preg_match("/^\/guide\/henpin\//"$uri) and !preg_match("/^\/guide\/shiharai\//"$uri)) echo "#header-menu-4-1 { background-position: -108px -81px !important; }";
  220.         if (preg_match("/^\/guide\/print-shurui\//"$uri)) echo "#header-menu-4-2 { background-position: -108px -187px !important; }";
  221.         if (preg_match("/^\/guide\/price-silk\//"$uri)) echo "#header-menu-4-3 { background-position: -108px -293px !important; }";
  222.         if (preg_match("/^\/print\/font-menu\//"$uri)) echo "#header-menu-4-4 { background-position: -108px -399px !important; }";
  223.         if (preg_match("/^\/guide\/henpin\//"$uri)) echo "#header-menu-4-5 { background-position: -108px -505px !important; }";
  224.         if (preg_match("/^\/guide\/shiharai\//"$uri)) echo "#header-menu-4-6 { background-position: -108px -611px !important; }";
  225.         if (preg_match("/^\/faq\//"$uri)) echo "#header-menu-4-7 { background-position: -108px -717px !important; }";
  226.         if (preg_match("/^\/sample-order\//"$uri)) echo "#header-menu-4-8 { background-position: -108px -823px !important; }";
  227.         if (preg_match("/^\/company\//"$uri)) echo "#header-menu-4-9 { background-position: -108px -929px !important; }";
  228.         return "";
  229.     }
  230.     public function getFooterMainCategory()
  231.     {
  232.         // TODO: MainCategoryページのFooterで ページDescription取得
  233.         /**
  234.          * [
  235.          *  [
  236.          *    name: 'description',
  237.          *    content: 'TEST'
  238.          *  ]
  239.          *  ...
  240.          * ]
  241.          */
  242.         $response = [
  243.             [
  244.                 'name' => 'description',
  245.                 'content' => 'TEST'
  246.             ]
  247.         ];
  248.         return $response;
  249.     }
  250.     public function getLeftFbnrs()
  251.     {
  252.         $viewCacheKey $this->lmHelper->getCacheKey('getLeftFbnrs', []);
  253.         return $this->getCacheByKey($viewCacheKey, function() {
  254.             $result = [];
  255.             $fbnrs array_values(array_filter($this->dynamicConverter->getFbnrs(), function ($fbnr) {
  256.                 return !empty($fbnr['fbnr_content']);
  257.             }));
  258.             $result[] = array_shift($fbnrs);
  259.             return $result;
  260.         });
  261.     }
  262.   public function displayText($text)
  263.   {
  264.     return nl2br(str_replace(">","&gt;",str_replace("<","&lt;",stripslashes($text))));
  265.   }
  266.   public function LM_sashikomi($srcHtml)
  267.   {
  268.     $CFIMG_URL $this->eccubeConfig['CFIMG_URL'] . '/';
  269.     $BACKIMG_URL $this->eccubeConfig['BACKIMG_URL'];
  270.         $dstHtml $srcHtml;
  271.         $dstHtml str_replace('"img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  272.         $dstHtml str_replace('"/img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  273.         $dstHtml str_replace('"./img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  274.         $dstHtml str_replace('"../img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  275.         $dstHtml str_replace('http://www.l-m.co.jp/img/',$CFIMG_URL."public_img/",$dstHtml);
  276.         $dstHtml str_replace('https://www.l-m.co.jp/img/',$CFIMG_URL."public_img/",$dstHtml);
  277.         $dstHtml str_replace('"images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  278.         $dstHtml str_replace('"/images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  279.         $dstHtml str_replace('"./images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  280.         $dstHtml str_replace('"../images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  281.         $dstHtml str_replace('http://www.l-m.co.jp/images/',$CFIMG_URL."public_images/",$dstHtml);
  282.         $dstHtml str_replace('https://www.l-m.co.jp/images/',$CFIMG_URL."public_images/",$dstHtml);
  283.         $dstHtml str_replace('url(images/','url('.$CFIMG_URL.'public_images/',$dstHtml);
  284.         $dstHtml str_replace('url(/images/','url('.$CFIMG_URL.'public_images/',$dstHtml);
  285.         $dstHtml str_replace('url(\'images/','url(\''.$CFIMG_URL.'public_images/',$dstHtml);
  286.         $dstHtml str_replace('url(\'/images/','url(\''.$CFIMG_URL.'public_images/',$dstHtml);
  287.         $dstHtml str_replace('url("images/','url("'.$CFIMG_URL.'public_images/',$dstHtml);
  288.         $dstHtml str_replace('url("/images/','url("'.$CFIMG_URL.'public_images/',$dstHtml);
  289.         $dstHtml str_replace('"item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  290.         $dstHtml str_replace('"/item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  291.         $dstHtml str_replace('"./item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  292.         $dstHtml str_replace('"../item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  293.         $dstHtml str_replace('http://www.l-m.co.jp/item/kihon/',$BACKIMG_URL."public_item/kihon/",$dstHtml);
  294.         $dstHtml str_replace('https://www.l-m.co.jp/item/kihon/',$BACKIMG_URL."public_item/kihon/",$dstHtml);
  295.         $dstHtml str_replace('url(item/kihon/','url('.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  296.         $dstHtml str_replace('url(/item/kihon/','url('.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  297.         $dstHtml str_replace('url(\'item/kihon/','url(\''.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  298.         $dstHtml str_replace('url(\'/item/kihon/','url(\''.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  299.         $dstHtml str_replace('url("item/kihon/','url("'.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  300.     $dstHtml str_replace('url("/item/kihon/','url("'.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  301.     return $dstHtml;
  302.   }
  303.   public function renderCategoryList($mcMcName$mcName$data$canonicalMcData$categoryData$dataItem$subCategoryList$ctId)
  304.   {
  305.       // 配下カテゴリ
  306.       $canonicalMcName $mcName;
  307.       if (!empty($mcMcName)) {
  308.           $canonicalMcName "{$mcMcName}/{$mcName}";
  309.       } else if (!empty($data['main_category_main_category_webname'])) {
  310.           $canonicalMcName "{$data['main_category_main_category_webname']}/{$mcName}";
  311.       }
  312.       if (!empty($canonicalMcData)) {
  313.           $data $canonicalMcData;
  314.           $canonicalMcName $data['main_category_webname'];
  315.           if (!empty($data['main_category_main_category_webname'])) {
  316.               $canonicalMcName "{$data['main_category_main_category_webname']}/{$canonicalMcName}";
  317.           }
  318.       } else if ($categoryData == null) {
  319.           $data $data;
  320.       } else {
  321.           $data $categoryData;
  322.       }
  323.       // 件数リスト
  324.       $categoryCntList = array();
  325.       if (isset($dataItem)) {
  326.           foreach ($dataItem as $_item) {
  327.               $categoryCntList[$_item['category_id']] = $_item['cnt'] ?? 0;
  328.           }
  329.       }
  330.   }
  331.     public function getRightFbnrs()
  332.     {
  333.         $viewCacheKey $this->lmHelper->getCacheKey('getRightFbnrs', []);
  334.         $fbnrs array_values(array_filter($this->dynamicConverter->getFbnrs(), function ($fbnr) {
  335.             return !empty($fbnr['fbnr_content2']);
  336.         }));
  337.         $result = [];
  338.         $result[] = array_shift($fbnrs);
  339.         $pageType $this->lmHelper->getPageType();
  340.         if ($pageType['value'] === 'print-shurui') {
  341.             $shuruiSideMenu[]['fbnr_content2'] = '
  342.             <div id="print-shurui-side-nav">
  343.                 <dl>
  344.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_anchor">シルクプリント</a></dt>
  345.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_k" class="allsale_h">価格</a></dd>
  346.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_kd">├型代</a></dd>
  347.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_pd">├プリント代</a></dd>
  348.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_im">└色見本</a></dd>
  349.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#staff_anchor">STAFF無料型</a></dt>
  350.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#magic_anchor">マジックプリント</a></dt>
  351.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#transfer_anchor">転写</a></dt>
  352.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#embroidery_anchor">刺繍</a></dt>
  353.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_k" class="allsale_h">価格</a></dd>
  354.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_sya">├社名刺繍</a></dd>
  355.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_logo">├ロゴマーク</a></dd>
  356.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_im">└色見本</a></dd>
  357.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#threedimensional_anchor">立体刺繍</a></dt>
  358.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#rehem_anchor">ズボンの裾直し</a></dt>
  359.                 </dl>
  360.             </div>';
  361.             return $shuruiSideMenu;
  362.         }
  363.         return $result;
  364.     }
  365.     public function getToeMessages()
  366.     {
  367.         $messages = (array)$this->dynamicConverter->getMessageList('cm_id, title, add_datetime'10);
  368.         $response = [
  369.             'total_count' => sizeof((array)$this->dynamicConverter->getMessageList()),
  370.             'data' => $messages
  371.         ];
  372.         return $response;
  373.     }
  374.     public function getMessageCategoriesCount()
  375.     {
  376.         $messages $this->dynamicConverter->getMessageCountByCategory();
  377.         return $messages;
  378.     }
  379.     public function getLMenuCss()
  380.     {
  381.         $uri $_SERVER['REQUEST_URI'];
  382.         if (preg_match("/^\/work\//"$uri)) echo "#side-nav.top-use #fixed-menu-1 { background-position: -165px 0 !important; }";
  383.         if (preg_match("/^\/anzengutsu\//"$uri)) echo "#side-nav.top-category #fixed-menu-2 { background-position: -165px -43px !important; }";
  384.         if (preg_match("/^\/jimufuku\//"$uri)) echo "#side-nav.top-use #fixed-menu-3 { background-position: -165px -86px !important; }";
  385.         if (preg_match("/^\/hakui\//"$uri) and !preg_match("/^\/hakui\/scrub\//"$uri)) echo "#side-nav.top-use #fixed-menu-4 { background-position: -165px -129px !important; }";
  386.         if (preg_match("/^\/scrub\//"$uri)) echo "#side-nav.top-use #fixed-menu-5 { background-position: -165px -172px !important; }";
  387.         if (preg_match("/^\/food-uniform\//"$uri) and !preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#side-nav.top-use #fixed-menu-6 { background-position: -165px -215px !important; }";
  388.         if (preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#side-nav.top-use #fixed-menu-7 { background-position: -165px -258px !important; }";
  389.         if (preg_match("/^\/esthe-uniform\//"$uri) and !preg_match("/^\/towel\//"$uri)) echo "#side-nav.top-use #fixed-menu-8 { background-position: -165px -301px !important; }";
  390.         if (preg_match("/^\/care-wear\//"$uri)) echo "#side-nav.top-use #fixed-menu-9 { background-position: -165px -344px !important; }";
  391.         if (preg_match("/^\/patrol\//"$uri)) echo "#side-nav.top-use #fixed-menu-10 { background-position: -165px -387px !important; }";
  392.         if (preg_match("/^\/formal\//"$uri)) echo "#side-nav.top-use #fixed-menu-11 { background-position: -165px -430px !important; }";
  393.         if (preg_match("/^\/polo\//"$uri)) echo "#side-nav.top-category #fixed-menu-1 { background-position: -165px 0 !important; }";
  394.         if (preg_match("/^\/apron\//"$uri)) echo "#side-nav.top-category #fixed-menu-2 { background-position: -165px -43px !important; }";
  395.         if (preg_match("/^\/shirt\//"$uri) and !preg_match("/^\/shirt\/aloha\//"$uri)) echo "#side-nav.top-category #fixed-menu-3 { background-position: -165px -86px !important; }";
  396.         if (preg_match("/^\/tshirt\//"$uri)) echo "#side-nav.top-category #fixed-menu-4 { background-position: -165px -129px !important; }";
  397.         if (preg_match("/^\/staff\//"$uri)) echo "#side-nav.top-category #fixed-menu-5 { background-position: -165px -172px !important; }";
  398.         if (preg_match("/^\/vest\//"$uri)) echo "#side-nav.top-category #fixed-menu-6 { background-position: -165px -215px !important; }";
  399.         if (preg_match("/^\/warm\//"$uri)) echo "#side-nav.top-category #fixed-menu-7 { background-position: -165px -258px !important; }";
  400.         if (preg_match("/^\/sweat\//"$uri)) echo "#side-nav.top-category #fixed-menu-8 { background-position: -165px -301px !important; }";
  401.         if (preg_match("/^\/pants\//"$uri)) echo "#side-nav.top-category #fixed-menu-9 { background-position: -165px -344px !important; }";
  402.         if (preg_match("/^\/shirt\/aloha\//"$uri)) echo "#side-nav.top-category #fixed-menu-10 { background-position: -165px -387px !important; }";
  403.         if (preg_match("/^\/happi\//"$uri)) echo "#side-nav.top-category #fixed-menu-11 { background-position: -165px -430px !important; }";
  404.         if (preg_match("/^\/cap\//"$uri)) echo "#side-nav.top-category #fixed-menu-12 { background-position: -165px -473px !important; }";
  405.         if (preg_match("/^\/overall\//"$uri)) echo "#side-nav.top-category #fixed-menu-13 { background-position: -165px -516px !important; }";
  406.         if (preg_match("/^\/towel\//"$uri)) echo "#side-nav.top-category #fixed-menu-14 { background-position: -165px -559px !important; }";
  407.         if (preg_match("/^\/bag\//"$uri)) echo "#side-nav.top-category #fixed-menu-15 { background-position: -165px -602px !important; }";
  408.         return "";
  409.     }
  410.     public function checkMcName($mcMcName$type)
  411.     {
  412.         $datas = [$mcMcName$type];
  413.         $viewCacheKey $this->lmHelper->getCacheKey("checkMcName"$datas);
  414.         return $this->getCacheByKey($viewCacheKey, function() use ($mcMcName$type) {
  415.             if ($type == 1) {
  416.                 return (
  417.                     $mcMcName != "polo" and
  418.                     $mcMcName != "shirt" and
  419.                     $mcMcName != "tshirt" and
  420.                     $mcMcName != "staff" and
  421.                     $mcMcName != "vest" and
  422.                     $mcMcName != "warm" and
  423.                     $mcMcName != "sweat" and
  424.                     $mcMcName != "pants" and
  425.                     $mcMcName != "cook-coat" and
  426.                     $mcMcName != "apron" and
  427.                     $mcMcName != "happi" and
  428.                     $mcMcName != "cap" and
  429.                     $mcMcName != "overall" and
  430.                     $mcMcName != "anzengutsu" and
  431.                     $mcMcName != "towel" and
  432.                     $mcMcName != "scrub" and
  433.                     $mcMcName != "bag" and
  434.                     $mcMcName != "work" and
  435.                     $mcMcName != "jimufuku" and
  436.                     $mcMcName != "hakui" and
  437.                     $mcMcName != "food-uniform" and
  438.                     $mcMcName != "esthe-uniform" and
  439.                     $mcMcName != "election-item" and
  440.                     $mcMcName != "care-wear" and
  441.                     $mcMcName != "patrol" and
  442.                     $mcMcName != "pachinko" and
  443.                     $mcMcName != "burtle" and
  444.                     $mcMcName != "tsdesign" and
  445.                     $mcMcName != "xebec" and
  446.                     $mcMcName != "aitoz" and
  447.                     $mcMcName != "jichodo" and
  448.                     $mcMcName != "jawin" and
  449.                     $mcMcName != "kurodaruma" and
  450.                     $mcMcName != "co-cos" and
  451.                     $mcMcName != "sowa" and
  452.                     $mcMcName != "joie" and
  453.                     $mcMcName != "bon" and
  454.                     $mcMcName != "boncierge" and
  455.                     $mcMcName != "enjoy" and
  456.                     $mcMcName != "selery" and
  457.                     $mcMcName != "mizuno" and
  458.                     $mcMcName != "folk" and
  459.                     $mcMcName != "lecoqsportif-nurse" and
  460.                     $mcMcName != "lumiere" and
  461.                     $mcMcName != "facemix" and
  462.                     $mcMcName != "arbe" and
  463.                     $mcMcName != "bonuni" and
  464.                     $mcMcName != "lecoqsportif-care" and
  465.                     $mcMcName != "heartgreen" and
  466.                     $mcMcName != "natural-smile" and
  467.                     $mcMcName != "pep" and
  468.                     $mcMcName != "printstar" and
  469.                     $mcMcName != "unitedathle" and
  470.                     $mcMcName != "maximum" and
  471.                     $mcMcName != "calala" and
  472.                     $mcMcName != "bspa" and
  473.                     $mcMcName != "counterbiz" and
  474.                     $mcMcName != "glimmer" and
  475.                     $mcMcName != "daluc" and
  476.                     $mcMcName != "triumph" and
  477.                     $mcMcName != "sunpex" and
  478.                     $mcMcName != "formal" and
  479.                     $mcMcName != "whisel" and
  480.                     $mcMcName != "work-ladies" and
  481.                     $mcMcName != "work-gekiyasu" and
  482.                     $mcMcName != "work-stretch" and
  483.                     $mcMcName != "work-seiden" and
  484.                     $mcMcName != "work-cotton" and
  485.                     $mcMcName != "work-menpoli" and
  486.                     $mcMcName != "work-coolbiz" and
  487.                     $mcMcName != "work-warmbiz" and
  488.                     $mcMcName != "work-bouen" and
  489.                     $mcMcName != "work-nannen" and
  490.                     $mcMcName != "office-cute" and
  491.                     $mcMcName != "office-adult" and
  492.                     $mcMcName != "office-stock" and
  493.                     $mcMcName != "office-gekiyasu" and
  494.                     $mcMcName != "office-muji" and
  495.                     $mcMcName != "office-check" and
  496.                     $mcMcName != "office-stripe" and
  497.                     $mcMcName != "office-border" and
  498.                     $mcMcName != "office-jacquard"
  499.                 );
  500.             } else if ($type == 2) { // 限定非表示したいエリアをここに入れる 2015.5.1 複数のとき、!= and
  501.                 return (
  502.                     $mcMcName != "pants" and
  503.                     $mcMcName != "cook-coat" and
  504.                     $mcMcName != "anzengutsu" and
  505.                     $mcMcName != "scrub" and
  506.                     $mcMcName != "bag" and
  507.                     $mcMcName != "work" and
  508.                     $mcMcName != "jimufuku" and
  509.                     $mcMcName != "hakui" and
  510.                     $mcMcName != "food-uniform" and
  511.                     $mcMcName != "esthe-uniform" and
  512.                     $mcMcName != "pachinko" and
  513.                     $mcMcName != "burtle" and
  514.                     $mcMcName != "tsdesign" and
  515.                     $mcMcName != "xebec" and
  516.                     $mcMcName != "aitoz" and
  517.                     $mcMcName != "jichodo" and
  518.                     $mcMcName != "jawin" and
  519.                     $mcMcName != "kurodaruma" and
  520.                     $mcMcName != "co-cos" and
  521.                     $mcMcName != "sowa" and
  522.                     $mcMcName != "joie" and
  523.                     $mcMcName != "bon" and
  524.                     $mcMcName != "boncierge" and
  525.                     $mcMcName != "enjoy" and
  526.                     $mcMcName != "selery" and
  527.                     $mcMcName != "mizuno" and
  528.                     $mcMcName != "folk" and
  529.                     $mcMcName != "lecoqsportif-nurse" and
  530.                     $mcMcName != "lumiere" and
  531.                     $mcMcName != "facemix" and
  532.                     $mcMcName != "arbe" and
  533.                     $mcMcName != "bonuni" and
  534.                     $mcMcName != "lecoqsportif-care" and
  535.                     $mcMcName != "heartgreen" and
  536.                     $mcMcName != "natural-smile" and
  537.                     $mcMcName != "pep" and
  538.                     $mcMcName != "calala" and
  539.                     $mcMcName != "bspa" and
  540.                     $mcMcName != "counterbiz"
  541.                 );
  542.             }
  543.             return false;
  544.         });
  545.     }
  546.     public function getTotalDailyRanking()
  547.     {
  548.         $goods = (array)$this->dynamicConverter->getRankingList();
  549.         $response = [
  550.             'all' => array(),
  551.             'sagyoufuku' => array(),
  552.             'jimufuku' => array(),
  553.             'hakui' => array(),
  554.             'inshoku' => array()
  555.         ];
  556.         foreach ($goods as $good) {
  557.             $good['image_url'] = $this->makeImageURL('goods.img'$good['goods_id']);
  558.             switch ($good['goods_genre_text']) {
  559.                 case '':
  560.                     $good['goods_genre_text'] = '総合';
  561.                     $response['all'][$good['ranking_no']] = $good;
  562.                     break;
  563.                 case '作業服':
  564.                     $response['sagyoufuku'][$good['ranking_no']] = $good;
  565.                     break;
  566.                 case '事務服':
  567.                     $response['jimufuku'][$good['ranking_no']] = $good;
  568.                     break;
  569.                 case '白衣':
  570.                     $response['hakui'][$good['ranking_no']] = $good;
  571.                     break;
  572.                 case '飲食':
  573.                     $response['inshoku'][$good['ranking_no']] = $good;
  574.                     break;
  575.             }
  576.         }
  577.         foreach ($response as $key => $dummy) {
  578.             ksort($response[$key]);
  579.         }
  580.         return $response;
  581.     }
  582.     public function getTopics()
  583.     {
  584.         $results $this->dynamicConverter->getTopicData();
  585.         return $results;
  586.     }
  587.     public function getS3LmDocPath()
  588.     {
  589.         $path ''// $this->eccubeConfig['S3_LM_DOC_PATH'];
  590.         return $path;
  591.     }
  592.     public function getMonths()
  593.     {
  594.         $months = array();
  595.         for ($i 1$i <= 12$i++) {
  596.             $months[] = $i;
  597.         }
  598.         return $months;
  599.     }
  600.     public function getDays()
  601.     {
  602.         $days = array();
  603.         for ($i 1$i <= 31$i++) {
  604.             $days[] = $i;
  605.         }
  606.         return $days;
  607.     }
  608.     public function replaceItemImageRoot($html)
  609.     {
  610.         $dstHtml $html;
  611.         return $dstHtml;
  612.     }
  613.     public function LM_displaySashikomi_mainCategory($value)
  614.     {
  615.         if ($value != "") {
  616.             if (file_exists($filename "files/insert/{$value}")) {
  617.                 $file implode(""file($filename));
  618.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  619.                 $tmp explode("<body>"$file);
  620.                 if (count($tmp) > 1) {
  621.                     $tmp explode("</body>"$tmp[1]);
  622.                 } else {
  623.                     $tmp explode("</body>"$tmp[0]);
  624.                 }
  625.                 $tmp $this->replaceItemImageRoot($tmp[0]);
  626.                 return "<div style='line-height:12px'><br /></div>" $tmp;
  627.             }
  628.         }
  629.         return "";
  630.     }
  631.     private function addAttrRegexp($src$attrname, array $dst)
  632.     {
  633.         $attrs preg_replace_callback("/{$attrname}=\"([^\"]+)\"/", function ($matches) {
  634.             return $matches[1];
  635.         }, $src);
  636.         $attrs explode(' '$attrs);
  637.         $attrs $dst $attrs;
  638.         $attrs implode(' '$attrs);
  639.         return $attrs;
  640.     }
  641.     public function sliderFilter($value)
  642.     {
  643.         //
  644.         if (preg_match('/class="swiper-wrapper/'$value)) {
  645.             return $value;
  646.         }
  647.         // bxSlider
  648.         $value preg_replace_callback('/<ul([^<>]*(?:bxslider|foobar)[^<>]*)>(.*?)<\/ul>/s', function ($matches) {
  649.             //
  650.             $org $matches[0];
  651.             //
  652.             $classes $this->addAttrRegexp($matches[1], 'class', [
  653.                 'swiper-wrapper',
  654.             ]);
  655.             // echo $classes, PHP_EOL;
  656.             // TODO: その他の属性の対応
  657.             $attrs " class=\"{$classes}\"";
  658.             $li preg_replace_callback('/<li([^<>]*)>/', function ($matches) {
  659.                 //
  660.                 $classes $this->addAttrRegexp($matches[1], 'class', [
  661.                     'swiper-slide',
  662.                 ]);
  663.                 // echo $classes, PHP_EOL;
  664.                 //
  665.                 return "<li class=\"{$classes}\">";
  666.             }, $matches[2]);
  667.             //
  668.             $swiper "<div class=\"swiper-container\">
  669.                 <ul{$attrs}>{$li}</ul>
  670.                 <div class=\"swiper-pagination\"></div>
  671.                 <div class=\"swiper-button-prev\"></div>
  672.                   <div class=\"swiper-button-next\"></div>
  673.                 <div class=\"swiper-scrollbar\"></div>
  674.             </div>";
  675.             // var_dump(compact('matches', 'attrs', 'li', 'swiper'));
  676.             //
  677.             return $swiper;
  678.         }, $value);
  679.         //
  680.         return $value;
  681.     }
  682.     public function pregMatch($pattern$value$result)
  683.     {
  684.         return preg_match($pattern$value$result);
  685.     }
  686.     public function LM_detailLink2($data$mcName ""$ctName ""$useItemUrlDuplicated true)
  687.     {
  688.         $item_id = !empty($data['goods_canonical_hinban']) ? $data['goods_canonical_hinban'] : $data['goods_id'];
  689.         if (!$useItemUrlDuplicated) {
  690.             $url "/item/{$item_id}.html";
  691.         } else if ($mcName === 'nagaileben') {
  692.             // ナガイレーベンの場合のみ、プレーンURLとする
  693.             $url "/item/{$item_id}.html";
  694.         } else if ($mcName != "" && $ctName == "") {
  695.             $url "/item/{$item_id}/{$mcName}.html";
  696.         } else if ($mcName != "" && $ctName != "") {
  697.             $url "/item/{$item_id}/{$mcName}/{$ctName}.html";
  698.         }
  699.         echo $url;
  700.     }
  701.     public function getDefaultSpOtherCategoryPulldownMap()
  702.     {
  703.         return $this->commonService->getSpOtherCategoryPulldownMap();
  704.     }
  705.     public function renderSpHeader($main_h1$category_h1$h1_comment$data$custom_menu$recentviews$custom_frequently_searched_word$other_category_path_map = [])
  706.     {
  707.         $html '';
  708.             $cartCount $this->get_carts_total_quantity();
  709.             if (!strstr($_SERVER["REQUEST_URI"], "/estimate")) {
  710.                 $html '<nav id="ut-sp-global-navi">';
  711.                 // キャッシュが無効(通常通り出力)
  712.                 $temp $this->sp_h1($main_h1$category_h1$h1_comment$data);
  713.                 $html "{$html}{$temp}";
  714.                 $html $html '<ul>
  715.           <li class="navi-home"><a href="/" data-ajax="false"><i class="material-icons">home</i><span>ホーム</span></a></li>
  716.           <li class="navi-tel"><a href="tel:0120115116" class="cv-tel" data-ajax="false"><i class="material-icons">phone</i><span>電話</span></a></li>
  717.           <li class="navi-cart"><a href="/cart/" data-ajax="false"><i class="material-icons">shopping_cart</i><span>カート<div class="cart-item-badge' . (isset($_SESSION['cart']['type']) && $_SESSION['cart']['type'] == "sample" ' sample' '') . '"><b>' $cartCount '</b></div></span></a></li>
  718.           <li class="navi-search"><a href="#" data-ajax="false" data-slide-panel="search"><i class="material-icons">search</i><span>検索</span></a></li>
  719.           <li class="navi-menu"><a href="#" data-ajax="false" data-slide-panel="menu"><i class="material-icons">menu</i><span>メニュー</span></a></li>
  720.         </ul>';
  721.                 $html "{$html}</nav>";
  722.                 $temp $this->slide_panel_menu($custom_menu$recentviews$other_category_path_map);
  723.                 $html "{$html}{$temp}";
  724.                  $temp $this->slide_panel_search($data$custom_frequently_searched_word$custom_menu$other_category_path_map$recentviews);
  725.                 $html "{$html}{$temp}";
  726.             }
  727.         $allowedNewCss = ['/mypage/history/''/mypage/mhistory/''/mypage/chistory/''/mypage/contact/''/mypage/update/'];
  728.         $currentURI parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
  729.         if (!in_array($currentURI$allowedNewCss)) {
  730.             $html $html '<div id="logo">
  731.                                 <a href="/" data-ajax="false"><img src="https://img0.land-mark.biz/ut_img/public_images/header/site_logo_mini.jpg" alt="ユニフォームタウン" /></a>
  732.                             </div>';
  733.         } else {
  734.             $html $html '<div id="logo">
  735.                             <a href="/" data-ajax="false"><img src="/stylesheets/images/icons-svg/union.svg" alt="ユニフォームタウン" /></a>
  736.                         </div>
  737.                         <div id="working-time-wrapper">
  738.                             <img class="working-hour" src="/stylesheets/images/icons-svg/working_hour.svg" />
  739.                             <img src="/stylesheets/images/icons-svg/day_off.svg" />
  740.                         </div>
  741.                         ';
  742.         }
  743.         echo $html;
  744.     }
  745.     private function sp_h1($main_h1$category_h1$h1_comment$data)
  746.     {
  747.         if (isset($main_h1) && $main_h1 != "") {
  748.             return "<h1>" $main_h1 "</h1>";
  749.         } elseif (isset($category_h1) && $category_h1 != "") {
  750.             return "<h1>" $category_h1 "</h1>";
  751.         } elseif (isset($h1_comment) && $h1_comment trim($h1_comment)) {
  752.             return "<h1>" $h1_comment "</h1>";
  753.         } elseif (isset($data['goods_h1']) && $data['goods_h1'] != "") {
  754.             // if (isset($data['goods'])) return str_replace('品番', '', $data['kataban'] ?? '') . " {$data['goods']['goods_maker_name_text']} {$data['goods']['goods_name']}";
  755.             // return "<h1>" . ($data['main_h1_tag'] ?? '') . "</h1>";
  756.             return "<h1>" . ($data['goods_h1'] ?? '') . "</h1>";
  757.         } else if ($h1 $this->getTitleStr($_SERVER["REQUEST_URI"])) {
  758.             return "<h1>{$h1}</h1>";
  759.         }
  760.         return "";
  761.     }
  762.     private function getTitleStr($urlStr)
  763.     {
  764.         // 2014.06.24 update : main-category, itemコントローラは個別layout内で解決する。
  765. //        $obj = new BaseLibraryModel();
  766. //        $db = $obj->dbConnection();
  767.         if (strpos($urlStr'?')) {
  768.             $urlStr substr($urlStr0strpos($urlStr'?'));
  769.         }
  770.         if (substr($urlStr01) == "/") {
  771.             $urlStr substr($urlStr1);
  772.         }
  773.         $h1_comment "";
  774.         $tmpArray = array();
  775.         $tmpArrays preg_split("(\/)"$urlStr);
  776. //        if ($tmpArrays[2] != "") {
  777. //            include FRONT_PATH . "an_ct/" . $tmpArray[1] . "/" . $tmpArray[2] . ".inc";
  778. //            $h1_comment = $this->displayText($data['category_data']['category_h1_tag'] != "" ? $data['category_data']['category_h1_tag'] : "");
  779. //        } elseif ($tmpArrays[1] != "") {
  780. //            include FRONT_PATH . "an_mc/" . $tmpArray[1] . ".inc";
  781. //            $h1_comment = $this->displayText($data['main_h1_tag'] != "" ? $data['main_h1_tag'] : "");
  782. //        }
  783.         if (substr($urlStr01) == "/") {
  784. //            $urlStr = substr($urlStr, 1, mb_strlen($urlStr));
  785.         }
  786.         if (trim($h1_comment) == "") {
  787.             $tmpArray['index'] = "ユニフォームのプリント専門店 UniformTownへようこそ";
  788.             $tmpArray['sitemap'] = "サイトマップ";
  789.             $tmpArray['sitemap/detail'] = "商品カテゴリ別サイトマップ";
  790.             $tmpArray['guide'] = "ユニフォームタウンを初めてご利用になられる方へ";
  791.             $tmpArray['print'] = "ユニフォームタウンの加工サービスについて";
  792.             $tmpArray['sample-order'] = "ユニフォームタウンのカタログ請求ページです。";
  793.             $tmpArray['mail'] = "メール問い合わせ";
  794.             $tmpArray['estimate'] = "ユニフォームタウンの見積りシミュレーション";
  795.             $tmpArray['login'] = "ユニフォームタウンのログインページ";
  796.             $tmpArray['login/sendinfo'] = "パスワードを忘れた方はこのページでお手続きをお願いします。";
  797.             $tmpArray['regi/thanks'] = "ユニフォームタウンの会員登録完了";
  798.             $tmpArray['regi'] = "ユニフォームタウンの会員登録";
  799.             $tmpArray['mypage/mhistory'] = "ユニフォームタウンでご購入いただいた履歴です";
  800.             $tmpArray['mypage/chistory'] = "ユニフォームタウンでサンプルのご請求頂いた履歴です";
  801.             $tmpArray['mypage/history'] = "ユニフォームタウンで購入いただいた履歴です";
  802.             $tmpArray['mypage/designlist'] = "デザインシミュレーションしていただいた履歴です";
  803.             $tmpArray['mypage/contact'] = "デザインデータの送付、領収書の発行などができます";
  804.             $tmpArray['mypage/update'] = "ユニフォームタウンの登録情報を更新できるページです";
  805.             $tmpArray['mypage/mylist'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  806.             $tmpArray['mypage/yoyaku'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  807.             $tmpArray['mypage'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  808.             $tmpArray['samplecart'] = "ユニフォームタウンのサンプル商品ショッピングカートページです。";
  809.             $tmpArray['samplecheck'] = "ユニフォームタウンでのサンプル申込み内容をご確認ください。";
  810.             $tmpArray['item/by-product'] = "ユニフォームタウン - すべての商品";
  811.             $tmpArray['company/'] = "ユニフォームタウンの会社案内のページです。";
  812.             $tmpArray['company/showroom'] = "ショールームのご案内";
  813.             $tmpArray['company/use'] = "ユニフォームタウンをご利用するにあたっての環境について";
  814.             $tmpArray['company/agree/'] = "利用規約|ユニフォームの通販・プリント専門店 UniformTown";
  815.             $tmpArray['company/privacy'] = "ユニフォームタウンでの個人情報の保護方針と取扱いについて";
  816.             $tmpArray['company/law'] = "ユニフォームタウンの特定商取引法に基づく通販の表記ページです。";
  817.             $tmpArray['company/access'] = "ユニフォームタウンのショップ・アクセスへのページです。";
  818.             $tmpArray['company/china-factory'] = "ランドマークの中国工場";
  819.             $tmpArray['mail/backnumber'] = "バックナンバー";
  820.             $tmpArray['company/link'] = "ユニフォームタウンの相互リンク";
  821.             $tmpArray['company/link-detail'] = "相互リンク";
  822.             $tmpArray['company/link-form'] = "相互リンクお申し込みフォーム";
  823.             $tmpArray['company/idea'] = "ご意見・ご要望をお聞かせください";
  824.             $tmpArray['company/recruit'] = "ユニフォームタウンの求人情報のページです。";
  825.             $tmpArray['company/dictionary'] = "ユニフォームタウンの用語集のページです。";
  826.             $strArray $tmpArray;
  827.             foreach ($tmpArray as $key => $value) {
  828.                 $tmpAry preg_split("(\/)"$key);
  829.                 if ($urlStr == $key) {
  830.                     $h1_comment $strArray[$key];
  831.                 } elseif (strstr($urlStr"print") and $tmpAry[0] == "print") {
  832.                     $h1_comment $strArray[$key];
  833.                 } elseif (strstr($urlStr"guide") and $tmpAry[0] == "guide") {
  834.                     $h1_comment $strArray[$key];
  835.                 } elseif (strstr($urlStr"sample-order") and $tmpAry[0] == "sample-order") {
  836.                     $h1_comment $strArray[$key];
  837.                 } elseif ($urlStr == $tmpAry[0] and $h1_comment == "") {
  838.                     $h1_comment $strArray[$key];
  839.                 }
  840.             }
  841. //            $obj->closeConnection($db);
  842.         }
  843.         if (trim($h1_comment) == "") {
  844.             if (in_array($urlStr, ['shopping''shopping/confirm''shopping/checkout''shopping/complete''shopping/error'])) {
  845.                 $route str_replace('/''_'$urlStr);
  846.                 $page $this->pageRepository->getPageByRoute($route);
  847.                 $h1_comment "{$this->baseInfo->getShopName()}{$page->getName()}";
  848.             } else {
  849.                 $h1_comment "ユニフォームのプリント専門店 UniformTownへようこそ";
  850.             }
  851.         }
  852.         return $h1_comment;
  853.     }
  854.     public function get_carts_total_quantity()
  855.     {
  856.         if ($this->cartService->getCartType() == CartServiceCustomize::CartTypeCatalog) {
  857.             $catalogOrderList $this->commonService->GetLmOrderOption(CommonService::Lm_Option_Catalog);
  858.             $totalQuantity is_array($catalogOrderList) ? count($catalogOrderList) : 0;
  859.         } else {
  860.             $Carts $this->cartService->getCarts();
  861.             $totalQuantity array_reduce($Carts, function ($total$Cart) {
  862.                 $total += $Cart->getTotalQuantity();
  863.                 return $total;
  864.             }, 0);
  865.         }
  866.         return $totalQuantity;
  867.     }
  868.     function build_custom_menu($menu_list$is_top false)
  869.     {
  870.         if (empty($menu_list)) return '';
  871.         foreach ($menu_list as $menu) {
  872.             echo '<li class="menu-item ' . (($is_top && !empty($menu->children)) ? ' category-menu ' '') . ((!empty($menu->children)) ? ' has-child ' '') . '">';
  873.             if (empty($menu->children) && !empty($menu->url)) {
  874.                 echo '<a href="' htmlentities($menu->url) . '"><span>' htmlentities($menu->label) . '</span></a>';
  875.             } else {
  876.                 echo '<a><span>' htmlentities($menu->label) . '</span></a>';
  877.             }
  878.             if (!empty($menu->children)) {
  879.                 echo '<ul class="category-list">';
  880.                 echo $this->build_custom_menu($menu->children);
  881.                 echo '</ul>';
  882.             }
  883.             echo '</li>';
  884.         }
  885.     }
  886.     private function slide_panel_menu($custom_menu$recentviews$other_category_path_map = [])
  887.     {
  888.         if (empty($recentviews)) {
  889.             $cookies $this->RecentGoodsService->getRecentView();
  890.             $recentviews = !empty($cookies) ? $this->RecentGoodsService->LM_getRecentViews2($cookies) : array();
  891.         }
  892.         //
  893.         if (empty($other_category_path_map)) {
  894.             $other_category_path_map $this->getDefaultSpOtherCategoryPulldownMap();
  895.         }
  896.         $CFIMG_DOMAIN "img0.land-mark.biz";
  897.         $user $this->security->getUser();
  898.         echo '<style>
  899.         #recentviews .recentviews-item * {
  900.             max-width: none;
  901.         }
  902.         </style>';
  903.         echo '<div class="slide-panel-wrapper" data-slide-type="menu" style="display: none;">
  904.     <div id="slide-panel-menu" class="slide-panel">
  905.                 <ul>
  906.                     <li class="customer-info">
  907.                         <span class="youkoso">ようこそ</span><span class="customer_user_name">' . (isset($user) ? $user->getFullName() : 'ゲスト') . '</span><span class="san">さん</span>
  908.           </li>';
  909.         if (empty($custom_menu)) {
  910.             echo '<li class="menu-item menu-item-label">
  911.               <span>カテゴリーから探す</span>
  912.             </li>';
  913.             foreach ($other_category_path_map as $type => $type_data) {
  914.                 echo '<li class="menu-item category-menu has-child">';
  915.                 echo '<a><span>' $this->displayText($type_data['group_label']) . '</span></a>';
  916.                 if (!empty($type_data['map'])) {
  917.                     echo '<ul class="category-list">';
  918.                     foreach ($type_data['map'] as $path => $label) {
  919.                         echo '<li class="menu-item"><a href="' LmHelper::display_form_text($path) . '"><span>' $this->displayText($label) . '</span></a></li>';
  920.                     }
  921.                     echo '</ul>';
  922.                 }
  923.                 echo '</li>';
  924.             }
  925.         } else {
  926.             echo '<li class="menu-item menu-item-label">
  927.         <span>カテゴリーから探す</span>
  928.       </li>';
  929.             echo $this->build_custom_menu($custom_menutrue);
  930.         }
  931.         if (isset($user)) {
  932.             echo '<li class="menu-item"><a href="/mypage/"><span>マイページ</span></a></li>
  933.                     <li class="menu-item"><a href="/logout/"><span>ログアウト</span></a></li>';
  934.         } else {
  935.             echo '<li class="menu-item"><a href="/mypage/login/"><span>ログイン</span></a></li>
  936.                     <li class="menu-item"><a href="/regi/"><span>新規会員登録</span></a></li>';
  937.         }
  938.         $cartCount $this->get_carts_total_quantity();
  939.         echo '<li class="menu-item"><a href="/cart/" data-ajax="false"><span>カートの商品(<b>' number_format($cartCount) . '</b>点)を見る</span></a></li>
  940.                     <li class="menu-item recentviews-menu has-child opened">
  941.                         <a><span>閲覧履歴</span></a>
  942.                         <div class="recentviews ajax" style="margin-top:10px;">';
  943.         echo '<div id="recentviews" style="overflow: hidden; margin: 0;">
  944.     <div style="margin-left: 0;display:flex;overflow-x:scroll;-webkit-overflow-scrolling: touch;">';
  945.         foreach ($recentviews as $item) {
  946.             echo '<div class="recentviews-item" style="width: 105px; float: left;margin: 0 6px;margin-bottom: 15px;">
  947.           <div>
  948.             <a href="/item/' $this->displayText($item['item_id']) . '.html"><img class="recommend-images" style="height: auto; display: inline-block; border: 1px solid rgb(204, 204, 204); padding: 0; width: 105px;" src="' $this->makeImageURL("goods.img"$item['id']) . '" border="0" name="" alt="' $this->displayText($item['goods_name']) . '"></a>
  949.           </div>
  950.           <div style="margin-top: 5px; font-size: 11px;line-height:1.3em;">
  951.             <a href="/item/' $this->displayText($item['item_id']) . '.html">' $this->displayText($item['goods_name']) . '</a>
  952.           </div>
  953.           <div style="font-size: 11px; color: #666;">
  954.           <span class="recent_item_price">' number_format($item['min_gp_price']) . '円(税込)</span> ~ ' .
  955.           ((isset($item['review']) && $item['review'] > 0) ? ('<div class="recommend-average">' $item['average_img'] . '<span class="recommend-average-bracket">(</span><span class="recommend-average-point">' number_format($item['review']) . '</span><span class="recommend-average-bracket">)</span></div>') : '') . '</div></div>';
  956.         }
  957.         echo '</div></div>';
  958.         echo '</div>
  959.                     </li>
  960.                     <li class="menu-item"><a href="/mail/"><span>メール問合せ</span></a></li>
  961.                     <li class="menu-item"><a href="/cart/add_catalog"><span>カタログ請求する</span></a></li>
  962.                     <li class="menu-item menu-item-label"><span>ご案内</span></li>
  963.                     <li class="menu-item"><a href="/sp/pages/guide/"><span>初めての方へ</span></a></li>
  964.                     <li class="menu-item"><a href="/sp/pages/order/"><span>ご注文方法</span></a></li>
  965.                     <li class="menu-item"><a href="/guide/print-shurui/"><span>プリント・刺繍について</span></a></li>
  966.                     <li class="menu-item"><a href="/sp/pages/pay/"><span>お支払い方法</span></a></li>
  967.                     <li class="menu-item"><a href="/sp/pages/souryou/"><span>送料</span></a></li>
  968.                     <li class="menu-item"><a href="/sp/pages/nouki/" data-ajax="false"><span>納期</span></a></li>
  969.                     <li class="menu-item"><a href="/sp/pages/sample/" data-ajax="false"><span>貸出サンプル</span></a></li>
  970.                     <li class="menu-item"><a href="/sp/pages/oguchi/" data-ajax="false"><span>大口割引</span></a></li>
  971.                     <li class="menu-item"><a href="/sp/pages/henpin/" data-ajax="false"><span>返品・交換</span></a></li>
  972.                     <li class="menu-item"><a href="/sp/pages/faq/" data-ajax="false"><span>よくあるご質問</span></a></li>
  973.                     <li class="menu-item"><a href="/sp/pages/company_profile/" data-ajax="false"><span>会社概要</span></a></li>
  974.                     <li class="menu-item"><a href="/sp/pages/syozaiti/" data-ajax="false"><span>会社所在地</span></a></li>
  975.                     <li class="menu-item menu-footer-tel">
  976.                         <a href="tel:0120115116">
  977.                             <div class="tel-number"><img class="tel-icon" src="https://img0.land-mark.biz/ut_img/public_images/sp/icon_tel.svg" alt="電話"><span>0120-115-116</span></div>
  978.                             <div class="bussines-hour">(平日 9:00〜18:00)</div>
  979.                         </a>
  980.           </li>
  981.           <li class="menu-footer">
  982.                         <ul class="menu-footer-sns">
  983.                             <li class="tw"><a href="https://twitter.com/uniformtown" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_tw.svg);"></a></li>
  984.                             <li class="instagram"><a href="https://www.instagram.com/uniformtown/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_instagram.svg);"></a></li>
  985.                             <li class="fb"><a href="https://www.facebook.com/uniformtown91/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_fb.svg);"></a></li>
  986.                             <li class="youtube"><a href="https://www.youtube.com/channel/UCkSwlrLc4G-y_35KddreLxQ" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_youtube.svg);"></a></li>
  987.                         </ul>
  988.                         <button type="button">✕ メニューを閉じる</button>
  989.                     </li>
  990.                 </ul>
  991.             </div>
  992.         </div>';
  993.     }
  994.     private function slide_panel_search($data$custom_frequently_searched_word$custom_menu$other_category_path_map$recentviews)
  995.     {
  996.         $CFIMG_DOMAIN "img0.land-mark.biz";
  997.         echo '<style>
  998.         .searchpop_result {
  999.             overflow: hidden;
  1000.             width: 100%;
  1001.             text-align: left;
  1002.         }
  1003.         .searchpop_result_thumb {
  1004.             float: left;
  1005.             width: 90px;
  1006.             height: 83px;
  1007.             padding-top: 7px;
  1008.         }
  1009.         .searchpop_result_description p {
  1010.             line-height: 1.5;
  1011.         }
  1012.         .searchpop_result_description_goodsName {
  1013.             font-weight: bold;
  1014.             font-size: 14px;
  1015.             padding-top: 1px;
  1016.             margin-bottom: 3px !important;
  1017.             height: 18px;
  1018.             overflow: hidden;
  1019.         }
  1020.         .searchpop_result_description_goodsDetail {
  1021.             overflow: hidden;
  1022.             height: 1.5rem;
  1023.         }
  1024.     </style>';
  1025.         echo '<div class="slide-panel-wrapper" data-slide-type="search" style="display: none;">
  1026.       <div id="slide-panel-search" class="slide-panel">
  1027.         <ul>
  1028.           <li class="search-header">
  1029.             <span>詳細検索</span>
  1030.           </li>
  1031.           <li id="search-area" class="menu-item">
  1032.             <div id="search-area-search">
  1033.               <form method="get" action="/item/searchlist" method="get" accept-charset="UTF-8" id="search_form">
  1034.                 <input type="hidden" name="hantei" value="検索" />
  1035.                 <div>
  1036.                   <div id="search-word-input-wrapper">
  1037.                     <div id="search-word-input-area">
  1038.                       <input class="searchpop" id="search_string" name="searchtext" type="text" placeholder="商品名・品番で検索" value="" autocomplete="off">
  1039.                     </div>
  1040.                     <div><button id="search-button-on-slide-menu"><i class="material-icons">search</i></button></div>
  1041.                   </div>
  1042.                 </div>
  1043.               </form>
  1044.             </div>';
  1045.             //$this->displayText($data['searchtext']);
  1046.             if (!empty($custom_frequently_searched_word)) {
  1047.             echo '<div id="search-area-frequently-searched-words">
  1048.               <span>▼よく検索されているワード</span>
  1049.               <ul class="word-list">';
  1050.             foreach ($custom_frequently_searched_word as $search_word) {
  1051.                 echo '<li><a href="' $this->displayText($search_word->url) . '">' $this->displayText($search_word->label) . '</a></li>';
  1052.             }
  1053.             echo '</ul></div>';
  1054.         }
  1055.         echo '</li>';
  1056.         if (empty($custom_menu)) {
  1057.             echo '<li class="menu-item menu-item-label">
  1058.               <span>カテゴリーから探す</span>
  1059.             </li>';
  1060.             foreach ($other_category_path_map as $type => $type_data) {
  1061.                 echo '<li class="menu-item category-menu has-child">';
  1062.                 echo '<a><span>' $this->displayText($type_data['group_label']) . '</span></a>';
  1063.                 if (!empty($type_data['map'])) {
  1064.                     echo '<ul class="category-list">';
  1065.                     foreach ($type_data['map'] as $path => $label) {
  1066.                         echo '<li class="menu-item"><a href="' LmHelper::display_form_text($path) . '"><span>' $this->displayText($label) . '</span></a></li>';
  1067.                     }
  1068.                     echo '</ul>';
  1069.                 }
  1070.                 echo '</li>';
  1071.             }
  1072.         } else {
  1073.             echo '<li class="menu-item menu-item-label">
  1074.         <span>カテゴリーから探す</span>
  1075.       </li>';
  1076.             echo $this->build_custom_menu($custom_menutrue);
  1077.         }
  1078.         echo '<li class="menu-footer">
  1079.             <ul class="menu-footer-sns">
  1080.               <li class="tw"><a href="https://twitter.com/uniformtown" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_tw.svg);"></a></li>
  1081.               <li class="instagram"><a href="https://www.instagram.com/uniformtown/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_instagram.svg);"></a></li>
  1082.               <li class="fb"><a href="https://www.facebook.com/uniformtown91/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_fb.svg);"></a></li>
  1083.               <li class="youtube"><a href="https://www.youtube.com/channel/UCkSwlrLc4G-y_35KddreLxQ" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_youtube.svg);"></a></li>
  1084.             </ul>
  1085.             <button type="button">✕ メニューを閉じる</button>
  1086.           </li>
  1087.         </ul>
  1088.       </div>
  1089.     </div>';
  1090.     }
  1091.     function makeImageURL($folder$id)
  1092.     {
  1093.         $filename substr($id, -11) . "/" $id "/main.jpg";
  1094.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1095.         $t $filename;
  1096.         $url "https://" $CFIMG_DOMAIN "/";
  1097.         $ret $url $folder "/" $filename;
  1098.         return $ret;
  1099.     }
  1100.     function display_form_text($text)
  1101.     {
  1102.         // //return stripslashes( htmlspecialchars($text,ENT_QUOTES) ); 20100609
  1103.         //return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  1104.         return LmHelper::display_form_text($text);
  1105.     }
  1106.     function sashikomi($srcHtml$vw 805)
  1107.     {
  1108.         $dstHtml $srcHtml;
  1109.         // 画像の処理
  1110.         $dstHtml $this->LM_sashikomi($dstHtml);
  1111.         /*
  1112.         $dstHtml = preg_replace('@(<img[^>]+?src="('.CFIMG_URL.'public_images)/([^\'">\s]+)\.([^\.\'">\s]+)"[\s\S]*?>)@', '<picture><source media="(max-width: 320px)" type="image/webp" srcset="$2_320/$3.webp"><source media="(max-width: 640px)" type="image/webp" srcset="$2_640/$3.webp"><source media="(max-width: 320px)" srcset="$2_320/$3.$4"><source media="(max-width: 640px)" srcset="$2_640/$3.$4"><source type="image/webp" srcset="$2/$3.webp">$1</picture>', $dstHtml);
  1113.         */
  1114.         // スタイルタグの削除
  1115.         $dstHtml preg_replace_callback('/<style[\s\S]+?\/style>/', function ($matches) {
  1116.             if (preg_match('/<style[^>]+responsive/'$matches[0])) {
  1117.                 return $matches[0];
  1118.             } else {
  1119.                 return '';
  1120.             }
  1121.         }, $dstHtml);
  1122.         // 特定のインラインスタイルを削除
  1123.         // $dstHtml = preg_replace('/\s*(?:(?:margin|padding)(?:-(?:top|left|bottom|right))?|font-size)\s*:[^;]+;/', '', $dstHtml);
  1124.         // $dstHtml = preg_replace('/(style="[^">]*)(?:width)\s*:[^;]+;/', '$1', $dstHtml);
  1125.         // $dstHtml = preg_replace('/(style="[^">]*)(?:height)\s*:[^;]+;/', '$1', $dstHtml);
  1126.         // インラインスタイルでのpx指定は calc() に置換し、デバイスの画面幅を基準に計算させる
  1127.         $dstHtml preg_replace_callback('/\s*(?:(?:margin|padding)(?:-(?:top|left|bottom|right))?|font-size|top|left|bottom|right)\s*:[^;]+;/', function ($matches) use ($vw) {
  1128.             $dst $src $matches[0];
  1129.             $dst preg_replace('/-[0-9.]+px/'"0"$dst);
  1130.             $dst preg_replace('/([0-9.]+)px/'"calc($1 * (100vw / {$vw}))"$dst);
  1131.             return $dst;
  1132.         }, $dstHtml);
  1133.         $dstHtml preg_replace_callback('/(style="[^">]*)(?:width|height)\s*:[^;]+;/', function ($matches) use ($vw) {
  1134.             return preg_replace('/(width|height)[:\s]+([0-9.-]+)px/'"$1: calc($2 * (100vw / {$vw}))"$matches[0]);
  1135.         }, $dstHtml);
  1136.         // 特定の属性を削除
  1137.         $dstHtml preg_replace('/ width="?[^"\s>]+"?/'''$dstHtml);
  1138.         $dstHtml preg_replace('/ height="?[^"\s>]+"?/'''$dstHtml);
  1139.         // インライン要素間の余白を詰める
  1140.         $dstHtml preg_replace('/(\/a>)[\s]+?(<a)/''$1$2'$dstHtml);
  1141.         // 試しに<br>をSPでも出力してみる
  1142.         // // <br>はSPでは不要
  1143.         // if (!preg_match('@^/sp/owabi/@', $_SERVER['REQUEST_URI'])) // SPのお詫びページのみ<br>を削除せず
  1144.         // $dstHtml = preg_replace('/((?:\s*<br(?:[\s\/]*?)>)+)/', '', $dstHtml);
  1145.         //縮小画像取得エラー時のjsイベント処理
  1146.         $dstHtml preg_replace('/(\<img)[\s]+/''$1 onerror="replaceImg(this)"'$dstHtml);
  1147.         //
  1148.         $dstHtml $this->goodsPriceService->embedGoodsPrice($dstHtml);
  1149.         echo $dstHtml;
  1150.     }
  1151.     public function display_item_pulldown()
  1152.     {
  1153.         $base_link preg_replace('!/*(?:\?.+)?$!'''$_SERVER['REQUEST_URI']);
  1154.         $display_item_count_list $this->commonService->GetYaml('DisplayItem.yaml');
  1155.         /**
  1156.          * 表示件数プルダウン
  1157.          */
  1158.         $order_type_param = isset($_GET['type']) ? 'type=' . (int)$_GET['type'] . '&' '';
  1159.         $display_count_pulldown = array(
  1160.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'] . '件''link' => $base_link "/?{$order_type_param}disp=" $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'], 'selected' => false),
  1161.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM'] . '件''link' => $base_link "/?{$order_type_param}disp=" self::DISPLAY_ITEM_COUNT_MID'selected' => false),
  1162.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'] . '件''link' => $base_link "/?{$order_type_param}disp=" $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'], 'selected' => false),
  1163.         );
  1164.         // 表示件数プルダウン選択処理
  1165.         if (isset($_SESSION['display_max'])) {
  1166.             switch ((int)$_SESSION['display_max']) {
  1167.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW']:
  1168.                     $display_count_pulldown[0]->selected true;
  1169.                     break;
  1170.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM']:
  1171.                     $display_count_pulldown[1]->selected true;
  1172.                     break;
  1173.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH']:
  1174.                     $display_count_pulldown[2]->selected true;
  1175.                     break;
  1176.                 default:
  1177.                     $display_count_pulldown[1]->selected true;
  1178.                     break;
  1179.             }
  1180.         } else {
  1181.             if (isset($_GET['disp'])) {
  1182.                 switch ((int)$_GET['disp']) {
  1183.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW']:
  1184.                         $display_count_pulldown[0]->selected true;
  1185.                         break;
  1186.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM']:
  1187.                         $display_count_pulldown[1]->selected true;
  1188.                         break;
  1189.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH']:
  1190.                         $display_count_pulldown[2]->selected true;
  1191.                         break;
  1192.                     default:
  1193.                         $display_count_pulldown[1]->selected true;
  1194.                         break;
  1195.                 }
  1196.             } else {
  1197.                 foreach ($display_count_pulldown as $option) {
  1198.                     if ($option->count === $display_item_count_list['DISPLAY_ITEM_COUNT_DEFAULT']) $option->selected true;
  1199.                 }
  1200.             }
  1201.         }
  1202.         return $display_count_pulldown;
  1203.     }
  1204.     public function display_order_pulldown($useRecommendedItemOrder)
  1205.     {
  1206.         $base_link preg_replace('!/*(?:\?.+)?$!'''$_SERVER['REQUEST_URI']);
  1207.         $display_order_list $this->commonService->GetYaml('DisplayOrder.yaml')['DISPLAY_ORDER_ITEM'];
  1208.         /**
  1209.          * 表示順プルダウン
  1210.          */
  1211.         $display_count_param = isset($_GET['disp']) ? '&disp=' . (int)$_GET['disp'] : '';
  1212.         $display_order_pulldown = array(
  1213.             (object)array('label' => $display_order_list[0], 'link' => $base_link '/?type=6' $display_count_param'selected' => false),
  1214.             (object)array('label' => $display_order_list[1], 'link' => $base_link '/?type=0' $display_count_param'selected' => false),
  1215.             (object)array('label' => $display_order_list[2], 'link' => $base_link '/?type=5' $display_count_param'selected' => false),
  1216.             (object)array('label' => $display_order_list[3], 'link' => $base_link '/?type=1' $display_count_param'selected' => false),
  1217.             (object)array('label' => $display_order_list[4], 'link' => $base_link '/?type=3' $display_count_param'selected' => false),
  1218.         );
  1219.         // 表示順プルダウン選択処理
  1220.         //$order_param = '';
  1221.         if (isset($_SESSION['order_type'])) {
  1222.             switch ((int)$_SESSION['order_type']) {
  1223.                 case 0:
  1224.                     $display_order_pulldown[1]->selected true;
  1225.                     break;
  1226.                 case 1:
  1227.                     $display_order_pulldown[3]->selected true;
  1228.                     break;
  1229.                 case 3:
  1230.                     $display_order_pulldown[4]->selected true;
  1231.                     break;
  1232.                 case 5:
  1233.                     $display_order_pulldown[2]->selected true;
  1234.                     break;
  1235.                 case 6:
  1236.                     $display_order_pulldown[0]->selected true;
  1237.                     break;
  1238.                 default:
  1239.                     break;
  1240.             }
  1241.         } else {
  1242.             if (isset($_GET['type'])) {
  1243.                 switch ((int)$_GET['type']) {
  1244.                     case 0:
  1245.                         $display_order_pulldown[1]->selected true;
  1246.                         break;
  1247.                     case 1:
  1248.                         $display_order_pulldown[3]->selected true;
  1249.                         break;
  1250.                     case 3:
  1251.                         $display_order_pulldown[4]->selected true;
  1252.                         break;
  1253.                     case 5:
  1254.                         $display_order_pulldown[2]->selected true;
  1255.                         break;
  1256.                     case 6:
  1257.                         $display_order_pulldown[0]->selected true;
  1258.                         break;
  1259.                     default:
  1260.                         break;
  1261.                 }
  1262.             }
  1263.         }
  1264.         // おすすめ順が無効なときはプルダウンから外す
  1265.         if (!$useRecommendedItemOrderarray_shift($display_order_pulldown);
  1266.         return $display_order_pulldown;
  1267.     }
  1268.     public function getSessionData()
  1269.     {
  1270.         return $_SESSION;
  1271.     }
  1272.     /**
  1273.      * @param GoodsWithRelated $goods
  1274.      * @return string
  1275.      */
  1276.     public function renderGoodsLabelList(GoodsWithRelated $goods)
  1277.     {
  1278.         //
  1279.         $labelList $goods->getLabelList();
  1280.         //
  1281.         return $this->twig->render('Item/Parts/goods_label_list.twig', [
  1282.             'labelList' => $labelList,
  1283.         ]);
  1284.     }
  1285.     public function renderProductItem($item_data$useCache$average$col_count$vendingStatusMap = [])
  1286.     {
  1287.         // TODO: CFIMG_URL, BACKIMG_URLの変更
  1288.         $CFIMG_URL 'https://img0.land-mark.biz/ut_img/';
  1289.         $CATEGORY_LIST_ICON_ID_NO_SHOW 0;        // アイコンなし
  1290.         $CATEGORY_LIST_ICON_ID_SS 1;        // 春夏
  1291.         $CATEGORY_LIST_ICON_ID_AW 2;        // 秋冬
  1292.         $CATEGORY_LIST_ICON_ID_ALL 3;        // 通年
  1293.         $CATEGORY_LIST_ICON_ID_BOUKAN 4;        // 防寒
  1294.         // ジェンダーマップ
  1295.         $GENDER_ICON_MAP = array(
  1296.             => array('label' => '男性用''class' => 'goods-icon-male'),
  1297.             => array('label' => '女性用''class' => 'goods-icon-female'),
  1298.             => array('label' => '男女兼用''class' => 'goods-icon-unisex'),
  1299.             => array('label' => '子供用''class' => 'goods-icon-kids')
  1300.         );
  1301.         // アイコンマップ
  1302.         $CATEGORY_LIST_ICON_MAP = array(
  1303.             $CATEGORY_LIST_ICON_ID_SS => array('label' => '春夏''class' => 'goods-icon-ss'),
  1304.             $CATEGORY_LIST_ICON_ID_AW => array('label' => '秋冬''class' => 'goods-icon-aw'),
  1305.             $CATEGORY_LIST_ICON_ID_ALL => array('label' => '通年''class' => 'goods-icon-all'),
  1306.             $CATEGORY_LIST_ICON_ID_BOUKAN => array('label' => '防寒''class' => 'goods-icon-boukan')
  1307.         );
  1308.         $color_tip_max 30;
  1309.         $color_tip_break_at $color_tip_max 2;
  1310.         // アイコン
  1311.         if (
  1312.             (int)$item_data['goods_target_gender'] !== ||
  1313.             // (int)$item_data['color_count'] !== 0 ||
  1314.             (int)$item_data['goods_category_list_icon_id'] !== $CATEGORY_LIST_ICON_ID_NO_SHOW
  1315.         ) {
  1316.             echo '<div class="goods-icon-wrapper"><ul>';
  1317.             if (isset($GENDER_ICON_MAP[$item_data['goods_target_gender']])) {
  1318.                 echo '<li class="' $GENDER_ICON_MAP[$item_data['goods_target_gender']]['class'] . '">' $GENDER_ICON_MAP[$item_data['goods_target_gender']]['label'] . '</li>';
  1319.             }
  1320.            if ((int)$item_data['color_count'] !== 0) {
  1321.                echo '<li class="goods-icon goods-icon-color">' $item_data['color_count'] . '色</li>';
  1322.            }
  1323.             if (isset($CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']])) {
  1324.                 echo '<li class="' $CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']]['class'] . '">' $CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']]['label'] . '</li>';
  1325.             }
  1326.             echo '</ul></div>';
  1327.         }
  1328.         // // カラーチップ
  1329.         echo '<div class="item-color-tip"><ul>';
  1330.         foreach ($item_data['color_list'] as $color_idx => $rgb) {
  1331.             if ($color_idx === $color_tip_max) break;
  1332.             if ($color_idx !== && ($color_idx) % $color_tip_break_at === 0) {
  1333.                 echo '</ul><ul>';
  1334.             }
  1335.             echo '<li style="background-color: ' $rgb ';"></li>';
  1336.         }
  1337.         echo '</ul></div>';
  1338.         $goods_name_with_vending_status $this->getGoodsNameWithVendingStatusTo($item_data$vendingStatusMap);
  1339.         echo '<div class="gcont2"><div class="gname cat-list"><h3>';
  1340.         echo $this->displayText(!empty($goods_name_with_vending_status) ? $goods_name_with_vending_status $item_data['goods_name']);
  1341.         echo '<span>&nbsp;</span></h3></div>';
  1342.         echo '<div class="item-info">
  1343.                     <table>
  1344.                         <tr class="item-info-kataban">
  1345.                             <th><span>商品番号:</span></th><td><span>' $this->displayText($item_data['kataban']) . '</span></td>
  1346.                         </tr>';
  1347. //var_dump($item_data);
  1348. //        if (!$useCache) {
  1349.         if ($item_data['teika']) {
  1350.             echo '<tr class="item-info-list-price">
  1351.                             <th><span>定価:</span></th>';
  1352.             echo '<td><span>' number_format($item_data['teika']) . '</span><span>円 (税込)</span></td>';
  1353.             echo '</tr>';
  1354.         } else  {
  1355.             echo '<tr class="item-info-list-price">
  1356.                             <th></th>';
  1357.             echo '<td></td>';
  1358.             echo '</tr>';
  1359.         }
  1360.             echo '            <tr class="item-info-price">
  1361.                             <th><span>売価:</span></th>
  1362.                             <td><span style="font-size:24px;">' number_format($item_data['price']*1.10) . '</span><span>円(税込)</span></td></tr>';
  1363. /*        } else {
  1364.             echo '<tr class="item-info-list-price">
  1365.                             <th><span>定価:</span></th>
  1366.                             <td><span class="gprice_teika fbt-lazy"></span></td>
  1367.                         </tr>
  1368.                         <tr class="item-info-price">
  1369.                             <th><span>売価:</span></th>
  1370.                             <td><span class="gprice fbt-lazy price"></span><span class="yen_txt">円 (税込)</span></td>
  1371.                         </tr>';
  1372.         }*/
  1373.         echo '</table></div>';
  1374.         echo '<div class="gtest">';
  1375.         if (!empty($item_data['average'])) {
  1376.             $average_for_image = (int)($item_data['average'] * 2) / 2;
  1377.             echo '<div class="item-review-star">
  1378.         <img alt="お客様からの口コミレビュー評価の星の数' $average_for_image '" src="' $CFIMG_URL 'public_images/review/star_m' . ($average_for_image 10) . '.gif"><span class="item-review-star-average"></span><span class="item-review-star-review-count">(' $item_data['review_count'] . '<span class="item-review-star-review-count-unit"></span>)</span>
  1379.       </div>';
  1380.         }
  1381.         if ($item_data['goods_caption'] != "") {
  1382.             echo '<p class="item-caption">' mb_eregi_replace(" """$item_data['goods_caption']) . '<span>&nbsp;</span></p>';
  1383.         }
  1384.         echo '</div><!-- /.gtest -->';
  1385.         echo '</div>';
  1386.     }
  1387.     public function getGoodsNameWithVendingStatusTo($goods_data$vendingStatusMap)
  1388.     {
  1389.         if (!isset($goods_data['goods_id']) || !isset($goods_data['goods_name'])) return null;
  1390.         $VENDING_STATUS_MAP $vendingStatusMap;
  1391.         $GOODS_VENDING_STATUS_IS_VENDING 1;    // 販売中
  1392.         $GOODS_VENDING_STATUS_IS_SOLD_OUT 2;    // 完売
  1393.         $GOODS_VENDING_STATUS_IS_DISCONTINUED 3;    // 廃番
  1394.         $GOODS_VENDING_STATUS_LABEL_MAP = [
  1395.             $GOODS_VENDING_STATUS_IS_VENDING => '販売継続中',
  1396.             $GOODS_VENDING_STATUS_IS_SOLD_OUT => '完売',
  1397.             $GOODS_VENDING_STATUS_IS_DISCONTINUED => '廃番'
  1398.         ];
  1399.         // キャッシュがなければ生成
  1400.         if (empty($VENDING_STATUS_MAP)) {
  1401.             //
  1402.             $rows $this->getGoodsVendingStatusListCache();
  1403.             //
  1404.             foreach ($rows as $row) {
  1405.                 $VENDING_STATUS_MAP[(int)$row['goods_id']] = (int)$row['goods_vending_status'];
  1406.             }
  1407.         }
  1408.         $vending_status $VENDING_STATUS_MAP[(int)$goods_data['goods_id']] ?? null;
  1409.         $prefix '';
  1410.         if (empty($vending_status)) {
  1411.             $createNewFlg true;
  1412.             $this->GoodsService->getGoodsVendingStatusMap($createNewFlg);
  1413.         }
  1414.         switch ($vending_status) {
  1415.             case $GOODS_VENDING_STATUS_IS_SOLD_OUT:
  1416.                 $prefix '[' $GOODS_VENDING_STATUS_LABEL_MAP[$GOODS_VENDING_STATUS_IS_SOLD_OUT] . '] ';
  1417.                 break;
  1418.             case $GOODS_VENDING_STATUS_IS_DISCONTINUED:
  1419.                 $prefix '[' $GOODS_VENDING_STATUS_LABEL_MAP[$GOODS_VENDING_STATUS_IS_DISCONTINUED] . '] ';
  1420.                 break;
  1421.         }
  1422.         $goods_data['goods_name'] = $prefix $goods_data['goods_name'];
  1423.         if (isset($goods_data['goods_new_name'])) $goods_data['goods_new_name'] = $prefix $goods_data['goods_new_name'];
  1424.         return $goods_data['goods_name'];
  1425.     }
  1426.     public function getGoodsVendingStatusListCache()
  1427.     {
  1428.         if (file_exists($filename 'files/goods/goods_vending_status_list.json')) {
  1429.             $json file_get_contents($filename);
  1430.             $goodsVendingStatusList json_decode($json);
  1431.         } else {
  1432.             $goodsVendingStatusList $this->dynamicConverter->getGoodsVendingStatusList();
  1433.         }
  1434.         return $goodsVendingStatusList;
  1435.     }
  1436.     function lm_category_filter($mcName$categoryData$data$items$subCategoryList$canonicalSubCategoryList$leftmenuForCategoryData$canonicalMcName$ctName)
  1437.     {
  1438.         $BACK_URL $this->eccubeConfig['BACK_URL'];
  1439. //        if ($categoryData == null) {
  1440. //            $data = $data;
  1441. //        } else {
  1442. //            // TODO: とりあえずコメントアウト
  1443. //             $data = $categoryData['main_category'];
  1444. //            return null;
  1445. //        }
  1446.         // SEO用のキーワード設定
  1447. //        if (in_array($data['main_category_name'], array("作業服・作業着", "作業服バートル", "医療白衣", "エプロン", "防寒服", "スタッフジャンパー", "メディカルウェア", "エステユニフォーム"))) {
  1448. //            $seoKeyword = "";
  1449. //        } else {
  1450. //            $seoKeyword = $data['main_category_name'] . " ";
  1451. //        }
  1452.         for ($i 1$i <= count($items); $i++) {
  1453.             $anImgUrl $this->displayText(str_replace(array('backoffice/''main_bsum'), array($BACK_URL'main_45x45'), $items[$i 1]['image']));
  1454.             $goodsImgUrl $this->displayText(str_replace(array('backoffice/''main_bsum'), array($BACK_URL'main_45x45'), $items[$i 1]['goods_image']));
  1455.             if ($items[$i 1]['category_id'] != "coordinate" and $items[$i 1]['category_id'] != "allitem") {
  1456.                 if (isset($leftmenuForCategoryData[$items[$i 1]['category_id']])) {
  1457.                     echo "<li class=\"sepa\">{$leftmenuForCategoryData[$items[$i 1]['category_id']]['category_name']}</li><br>";
  1458.                 }
  1459.                 if (!empty($subCategoryList[$items[$i 1]['category_id']])) {
  1460.                     if ($ctName === $subCategoryList[$items[$i 1]['category_id']]['category_webname']) {
  1461.                         echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;">';
  1462.                         echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1463.                         echo "</li>";
  1464.                     } else {
  1465.                         if (!empty($subCategoryList[$items[$i 1]['category_id']]['category_webname'])) {
  1466.                             echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;"><a href="/' $canonicalMcName "/" $subCategoryList[$items[$i 1]['category_id']]['category_webname'] . '/">';
  1467.                             echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1468.                             echo "</a></li>";
  1469.                         } elseif (!empty($canonicalSubCategoryList[$items[$i 1]['category_id']]['category_webname'])) {
  1470.                             echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;"><a href="/' $canonicalMcName "/" $canonicalSubCategoryList[$items[$i 1]['category_id']]['category_webname'] . '/">';
  1471.                             echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1472.                             echo "</a></li>";
  1473.                         }
  1474.                     }
  1475.                 }
  1476.             }
  1477.         }
  1478.     }
  1479.     public function custom_parse_url($value)
  1480.     {
  1481.         return parse_url($valuePHP_URL_QUERY);
  1482.     }
  1483.     public function echoImageURL($imgUrl)
  1484.     {
  1485.         $IMG_HOST_NAME $this->eccubeConfig['IMG_HOST_NAME'];
  1486.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1487.         $CFIMG_URL $this->eccubeConfig['CFIMG_URL'];
  1488.         $imgUrl "{$CFIMG_URL}/{$imgUrl}";
  1489.         //ドメインが「www.l-m.co.jp」 or 「images.l-m.co.jp」の場合
  1490.         if (strpos($imgUrl"images.l-m.co.jp") !== false or strpos($imgUrl$IMG_HOST_NAME) !== false) {
  1491.             //ドメインが「www.l-m.co.jp」の場合
  1492.             if (strpos($imgUrl$IMG_HOST_NAME) !== false) {
  1493.                 //httpsの時、httpへ変換
  1494.                 if (!((isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == "on") or $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
  1495.                     $newImgUrl str_replace("https://""http://"$imgUrl);
  1496.                 } else {
  1497.                     //httpの時、「images.l-m.co.jp」へ変換
  1498.                     $newImgUrl str_replace($IMG_HOST_NAME"images.l-m.co.jp"$imgUrl);
  1499.                 }
  1500.                 //ドメインが「images.l-m.co.jp」の場合
  1501.             } elseif (strpos($imgUrl"images.l-m.co.jp") !== false) {
  1502.                 //httpsの時、httpへ変換
  1503.                 if (!((isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == "on") or $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
  1504.                     $newImgUrl str_replace("https://""http://"$imgUrl);
  1505.                 } else {
  1506.                     $newImgUrl $imgUrl;
  1507.                 }
  1508.             }
  1509.             return $imgUrl;
  1510.         } else {
  1511.             $newImgUrl $imgUrl;
  1512.             //相対パスの場合
  1513.             if (strstr($imgUrl"images") !== false and strstr($imgUrl"public") === false) {
  1514.                 $strurl strstr($imgUrl"images");
  1515.                 $imgUrl "https://" $CFIMG_DOMAIN "/ut_img/" str_replace("images""public_images"$strurl);
  1516.             }
  1517.             return $imgUrl;
  1518.         }
  1519.     }
  1520.     public function echoVirtualImages($imgUrl)
  1521.     {
  1522.         $IMG_HOST_NAME $this->eccubeConfig['IMG_HOST_NAME'];
  1523.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1524.         $CFIMG_URL $this->eccubeConfig['CFIMG_URL'];
  1525.         $imgUrl "{$CFIMG_URL}/{$imgUrl}";
  1526.         if (strstr($imgUrl"images") !== false and strstr($imgUrl"virtual_images") === false) {
  1527.             $strurl strstr($imgUrl"images");
  1528.             $imgUrl "https://" $CFIMG_DOMAIN "/ut_img/" str_replace("images""virtual_images"$strurl);
  1529.         }
  1530.         return $imgUrl;
  1531.     }
  1532.     public function get_updated_at()
  1533.     {
  1534.         $week_day_list = array('日''月''火''水''木''金''土');
  1535.         return sprintf('%s (%s)%d時%d分'date('Y年n月j日'), $week_day_list[date('w')], date('H'), date('i'));
  1536.     }
  1537.     public function LM_displaySashikomi_detailGoods($data$noEcho false)
  1538.     {
  1539.         if ($data['goods_top_sashikomi'] != "") {
  1540.             $sashikomi_top $this->replaceItemImageRoot($data['goods_top_sashikomi']);
  1541.             if ($noEcho) return $sashikomi_top;
  1542.             echo $sashikomi_top;
  1543.         } elseif ($data['goods_top_html'] != "") {
  1544.             if (file_exists("files/insert/" $data['goods_top_html'])) {
  1545.                 $file implode(""file("files/insert/" $data['goods_top_html']));
  1546.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  1547.                 $tmp explode("<body>"$file);
  1548.                 if (count($tmp) > 1) {
  1549.                     $tmp explode("</body>"$tmp[1]);
  1550.                 } else {
  1551.                     $tmp explode("</body>"$tmp[0]);
  1552.                 }
  1553.                 $tmp $tmp[0];
  1554.                 $tmp $this->replaceItemImageRoot($tmp);
  1555.                 if ($noEcho) return "<div style='line-height:5px'></div>" $tmp;
  1556.                 echo "<div style='line-height:5px'></div>" $tmp;
  1557.             }
  1558.         }
  1559.         echo "";
  1560.     }
  1561.     function LM_insertFile($data)
  1562.     {
  1563.         if ($data['goods_bottom_sashikomi'] != "") {
  1564.             echo $this->replaceItemImageRoot($data['goods_bottom_sashikomi']);
  1565.         } elseif ($data['goods_html'] != "") {
  1566.             if (file_exists("files/insert/" $data['goods_html'])) {
  1567.                 $file implode(""file("files/insert/" $data['goods_html']));
  1568.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  1569.                 $tmp explode("<body>"$file);
  1570.                 if (count($tmp) > 1) {
  1571.                     $tmp explode("</body>"$tmp[1]);
  1572.                 } else {
  1573.                     $tmp explode("</body>"$tmp[0]);
  1574.                 }
  1575.                 $tmp $tmp[0];
  1576.                 $tmp $this->replaceItemImageRoot($tmp);
  1577.                 echo $tmp;
  1578.             }
  1579.         }
  1580.     }
  1581.     public function createGetParamater($moji "?"$expect ""$and "&"$equal "=")
  1582.     {
  1583.         $getVar $_GET;
  1584.         $form "";
  1585.         $array explode(","$expect);
  1586.         while (!is_null($key key($getVar))) {
  1587.             if (!in_array($key$array)) {
  1588.                 if ($form != "") {
  1589.                     //$form .= $and . $key . $equal . urlencode( LmHelper::display_form_text($getVar[$key]) ); 20110104 /の変換処理修正
  1590.                     $form .= $and $key $equal str_replace("%2F""%252F"urlencode(LmHelper::display_form_text($getVar[$key])));
  1591.                     urlencode($getVar[$key]);
  1592.                 } else {
  1593.                     //$form = $moji . $key . $equal . urlencode( LmHelper::display_form_text($getVar[$key]) ); 20110104 /の変換処理修正
  1594.                     $form $moji $key $equal str_replace("%2F""%252F"urlencode(LmHelper::display_form_text($getVar[$key])));
  1595.                 }
  1596.             }
  1597.             next($getVar);
  1598.         }
  1599.         return $form;
  1600.     }
  1601.     public function LM_displayTogetherBuyDetail_new3($id$is_secret true$count false)
  1602.     {
  1603.         $rs $this->dynamicConverter->getGoodsLinkSelect($id$is_secret$count);
  1604.         $result = array();
  1605.         if (isset($rs)) {
  1606.             foreach ($rs as $row) {
  1607.                 $goodsId $row['goods_id'];
  1608.                 $result[$goodsId] = $row;
  1609.                 $average $this->dynamicConverter->getReviewAverage($goodsId);
  1610.                 $average = (!empty($average[$row['goods_id']])) ? $average[$row['goods_id']] : 0;
  1611.                 $image_name = (int)($average 2) / 10;
  1612.                 $result[$goodsId]['average'] = $average;
  1613.                 $result[$goodsId]['average_img'] = "<img class=\"history-average-img\" alt=\"お客様からの口コミレビュー評価の星の数{$average}\" src=\"/images/review/star_m{$image_name}.gif\">";
  1614.                 //$tempRow = $this->dynamicConverter->getReview($id, $is_secret);
  1615.                 //$result[$goodsId]['review_count'] = count($tempRow);
  1616.                 $result[$goodsId]['img'] = $this->makeImageURL("goods.img"$goodsId);
  1617.             }
  1618.         }
  1619.         return $result;
  1620.     }
  1621.     /**
  1622.      * Use this instead of `include 'Common/hoge.twig'`.
  1623.      *
  1624.      * @param string $hoge
  1625.      * @param string|null $piyo
  1626.      * @return string
  1627.      * @throws \Twig\Error\LoaderError
  1628.      * @throws \Twig\Error\RuntimeError
  1629.      * @throws \Twig\Error\SyntaxError
  1630.      */
  1631.     function hoge(string $hogestring $piyo null)
  1632.     {
  1633.         //
  1634.         $route $this->request->get('_route');
  1635.         $url $this->request->getPathInfo();
  1636.         //
  1637.         $context compact('hoge''piyo''route''url');
  1638.         //
  1639.         return $this->twig->render('Common/hoge.twig'$context);
  1640.     }
  1641.     public function getCommonContentsMap()
  1642.     {
  1643.         $common_contents_map $this->dynamicConverter->getCommonContentsMap($this->eccubeConfig['CommonContents']['SITE_TYPE_UT'], $this->eccubeConfig['CommonContents']['DEVICE_TYPE_SP'], $this->eccubeConfig['CommonContents']['IS_NOT_SUPER_CATEGORY_ID']);
  1644.         $common_header_contents_all '';
  1645.         $common_header_contents '';
  1646.         $uri $_SERVER['REQUEST_URI'];
  1647.         $webname trim($uri'/');
  1648.         if (isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_ALL']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']])) {
  1649.             $common_header_contents_all $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_ALL']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']];
  1650.         }
  1651.         if ($uri == '/' && isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_TOP']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']])) {
  1652.             $common_header_contents $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_TOP']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']];
  1653.         }
  1654.         else if (isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_SUPER_CATEGORY']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']][$webname])) {
  1655.             $common_header_contents $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_SUPER_CATEGORY']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']][$webname];
  1656.         }
  1657.         return [
  1658.             'common_header_contents_all' => $common_header_contents_all,
  1659.             'common_header_contents' => $common_header_contents
  1660.         ];
  1661.     }
  1662.     public function getCalendarInfo()
  1663.     {
  1664.         $week_array explode(",""7,1,2,3,4,5,6");
  1665.         //現在月を判別
  1666.         $now_array explode("-"date("Y-m-d"));
  1667.         //翌月を表示する
  1668.         $now_array array_merge($now_arrayexplode("-"date("Y-m-d"mktime(000intval($now_array[1]) + 11intval($now_array[0])))));
  1669.         //当日日付
  1670.         $today date("Ymd");
  1671.         $meyasun_date 0;    //お届け日の目安フラグ
  1672.         $add 1;
  1673.         if (date("Hi") >= "1200") {
  1674.             $add 2;
  1675.         }
  1676.         $prefecture 0;
  1677.         $options "";
  1678.         //加工
  1679.         $url "https://www.l-m.co.jp/index/check-holiday?date=" date("Y-m-d") . "&add=" $add "&kakou=1&area=0";
  1680.         $output file_get_contents($url);
  1681.         $obj json_decode($outputtrue);
  1682.         $date $obj['result'];
  1683.         $kakou_date substr($date04) . "-" ltrim(substr($date42), 0) . "-" ltrim(substr($date62), 0);
  1684.         //無地
  1685.         $url "https://www.l-m.co.jp/index/check-holiday?date=" date("Y-m-d") . "&add=" $add "&kakou=0&area=0";
  1686.         $output file_get_contents($url);
  1687.         $obj json_decode($outputtrue);
  1688.         $date $obj['result'];
  1689.         $muji_date substr($date04) . "-" ltrim(substr($date42), 0) . "-" ltrim(substr($date62), 0);
  1690.         return [
  1691.             'week_array' => $week_array,
  1692.             'now_array' => $now_array,
  1693.             'kakou_date' => $kakou_date,
  1694.             'muji_date' => $muji_date,
  1695.             'today' => $today
  1696.         ];
  1697.     }
  1698.     public function getHolidayInfo($year$month$day$week$count)
  1699.     {
  1700.         return $this->dynamicConverter->getHolidayInfo(intval($year), intval($month), intval($day), intval($week), intval($count));
  1701.     }
  1702.     /**
  1703.      * カート内の商品のIDを取得する
  1704.      * TODO: 現状、最初の1件のみを取得。
  1705.      *
  1706.      * @return int|void
  1707.      */
  1708.     protected function getGoodsIdFromCart()
  1709.     {
  1710.         //
  1711.         foreach ($this->cartService->getCarts() as $cart) {
  1712.             foreach ($cart->getCartItems() as $item) {
  1713.                 return $item->getProductClass()->getProduct()->getId();
  1714.             }
  1715.         }
  1716.     }
  1717.     public function getYouMayAlsoLike($goodsId null$count false)
  1718.     {
  1719.         //
  1720.         if (($goodsId !== null) || ($goodsId $this->getGoodsIdFromCart())) {
  1721.             //
  1722.             $displayTogether $this->reviewService->LM_displayTogetherBuyDetail_new3($goodsId$count);
  1723.             if (empty($displayTogether)) {
  1724.                 return null;
  1725.             }
  1726.             //
  1727.             $context compact('displayTogether');
  1728.             //
  1729.             return $this->twig->render('Review/recentview.twig'$context);
  1730.         }
  1731.         //
  1732.         return null;
  1733.     }
  1734.     /**
  1735.      * Get count of koe for template
  1736.      *
  1737.      * @return $koe_count
  1738.      */
  1739.     public function getKoeCount()
  1740.     {
  1741.         $viewCacheKey $this->lmHelper->getCacheKey('getKoeCount', []);
  1742.         return $this->getCacheByKey($viewCacheKey, function() {
  1743.             $koe_count $this->dynamicConverter->LM_get_koe_count();
  1744.             return $koe_count;
  1745.         });
  1746.     }
  1747.     /**
  1748.      * カテゴリページの表示順(order_type)を返す。
  1749.      *
  1750.      * @return int $order_type 表示順
  1751.      */
  1752.     public function getCategoryOrderType(){
  1753.         if( !is_null($this->request->get('type')) ){
  1754.             return (int)$this->request->get('type');
  1755.         }
  1756.         else {
  1757.             $session $this->request->getSession();
  1758.             if( $session->has('order_type') ){
  1759.                 return (int)$session->get('order_type');
  1760.             }
  1761.         }
  1762.         return null;
  1763.     }
  1764.     /**
  1765.      * @return bool
  1766.      */
  1767.     public function isShowSpHeader()
  1768.     {
  1769.         //
  1770.         $_route $this->request->get('_route');
  1771.         $cartCount $this->get_carts_total_quantity();
  1772.         //
  1773.         if ($_route === 'cart') {
  1774.             // カート(STEP 1)
  1775.             if ($cartCount == 0) {
  1776.                 // カート内の商品が1点も無い時だけ表示
  1777.                 return true;
  1778.             } else {
  1779.                 //
  1780.                 return true;
  1781.             }
  1782.         } else if (preg_match('@(?:shopping|estimate)@'$_route)) {
  1783.             // ショッピング(STEP 2-5)、見積シミュは非表示
  1784.             return true;
  1785.         } else {
  1786.             // それ以外はOK
  1787.             return true;
  1788.         }
  1789.     }
  1790.     /**
  1791.      * @param Goods $goods
  1792.      * @return string
  1793.      * @throws \Twig\Error\LoaderError
  1794.      * @throws \Twig\Error\RuntimeError
  1795.      * @throws \Twig\Error\SyntaxError
  1796.      */
  1797.     public function getSizeTable(Goods $goods)
  1798.     {
  1799.         //
  1800.         list($SizeList,$SizePosition) = $this->dynamicConverter->LM_displaySizeMatrix_cross2($goods->getGoodsId());
  1801.         //
  1802.         return $this->twig->render('Common/SizeTable.twig'compact('goods''SizeList''SizePosition'));
  1803.     }
  1804. }