<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Customize\Controller\Admin\Maker;
use Eccube\Controller\AbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Eccube\Util\CacheUtil;
use Knp\Component\Pager\Paginator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Customize\Repository\OrderRepository;
use Customize\Entity\Order;
use Plugin\Maker42\Repository\MakerRepository;
use Eccube\Repository\ProductRepository;
class MakerController extends AbstractController
{
/**
* @var OrderRepository
*/
protected $orderRepository;
/**
* @var MakerRepository
*/
protected $makerRepository;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @param OrderRepository $orderRepository
* @param MakerRepository $makerRepository
* @param ProductRepository $productRepository
*/
public function __construct(
OrderRepository $orderRepository,
MakerRepository $makerRepository,
ProductRepository $productRepository
)
{
$this->orderRepository = $orderRepository;
$this->makerRepository = $makerRepository;
$this->productRepository = $productRepository;
}
/**
* @Route("/%eccube_admin_route%/orderMaker", name="admin_maker")
* @Template("@admin/Maker/index.twig")
*/
public function index(Request $request)
{
// $Order = $this->orderRepository->findBy(array("maker_id" => !NULL));
$Order = $this->orderRepository->findAll();
$num = count($Order);
$id = [];
$maker_id = []; //maker_idを持つデータ
$maker_object = []; //存在するmaker_id
for($i=0; $i<$num;$i++) {
if ($Order[$i]["maker_id"] != null) {
array_push($id, $Order[$i]["id"]);
array_push($maker_id, $Order[$i]["maker_id"]);
$maker_object += array($Order[$i]["id"] => $Order[$i]["maker_id"]);
}
}
$numSelected = count($id);
// dd($id, $maker_id, $maker_object);
// dd($Order[$id[0]]);
$maker_score = [];
// for ($s=0; $s<$numSelected; $s++) {
// if ($Order[$id[$s]]["maker_id"]);
// }
$maker = $this->makerRepository->customFindAllArtist();
return [
'Order' => $Order,
'maker' => $maker,
];
}
/**
* @Method("GET")
* @Route("/%eccube_admin_route%/orderMaker/{id}", requirements={"id" = "\d+"}, name="admin_maker_selected")
* @Template("@admin/Maker/maker.twig")
*/
public function maker(Request $request, ?int $id = null)
{
$OrderSelected = $this->orderRepository->findBy(array("maker_id" => $id));
$num = count($OrderSelected);
$price = 0;
for($i=0; $i<$num;$i++) {
$price += $OrderSelected[$i]["total"];
}
$maker = $this->makerRepository->customFindAllArtist();
return [
'OrderSelected' => $OrderSelected,
"price" => $price,
'maker' => $maker,
'id' => $id,
];
}
/**
* @Route("/makerList", requirements={"id" = "\d+"}, name="admin_maker_list", methods={"GET"})
* @Template("Maker/list.twig")
*/
public function makerList()
{
$maker = $this->makerRepository->customFindAllArtist();
$emoji = ['😄','🐖','🐁','🐂','🐲','😉','🍕','🍔','🍟','🍗','🍖','🍝','🍛','🍤','🍱','😏','🍂','🌿','🌾','🍄','🌼','🌐','👲','👳','👮','👷','💂','👧','👨','👼','👸','😺','👺','🙈','🙉','🙊','💀','👽','💩','🔥','✨','🌟','💫','💥','👍','👐','🙌','👏','💪','🚶','🏃','💃','👫','👪','👬','👭','💏','💑','😍','😘','😚','😎','😴','😵','😲','👯','🙆','💁','🙋','💆','💇','💅','👰','🙎','🙍','🙇','🎩','👑','👒','👟','👞','👡','👠','👢','👕','👔','👚','👗','🎽','👖','👘','💄','💌','💍','💎','👤','👥','💬','👣','💭','🐶','🐺','🐱','🐭','🐹','🐰','🐸','🐯','🐨','🐻','🐷','🐽','🐮','🐗','🐵','🐒','🐴','🐑','🐘','🐼','🐧','🐦','🐤','🐥','🐣','🐞','🐌','🐙','🐚','🐠','🐟','🐬','🐳','🐋','🐄','🐏','🐀','🐃','🐅','🐇','🐉','🐎','🐐','🐓','🐕','🐡','🐊','🐫','🐈','🐩','🐾','💐','🌸','🌷','🍀','🌹','🌻','🌺','🍁','🍃','🌞','🌝','🌏','🌋','🌌','🌠','⭐','🌁','🌈','🌊','🎍','💝','🎎','🎒','🎓','🎏','🎆','🎇','🎐','🎑','🎃','👻','🎅','🎄','🎁','🎋','🎉','🎊','🎈','🎌','🔮','📼','💿','💽','💾','💻','📱','📞','📟','📠','📡','📺','📻','🔊','🔔','📢','📣','⏳','⌛','⏰','⌚','🔓','🔒','🔏','🔐','🔑','🔎','💡','🔦','🔆','🔅','🔌','🔋','🔍','🛁','🛀','🚿','🚽','🔧','🔩','🔨','🚪','🚬','💣','🔫','🔪','💊','💉','💰','💴','💵','💷','💶','💳','💸','📲','📧','📥','📤','✉','📩','📨','📯','📫','📪','📬','📭','📮','📦','📝','📇','📁','📂','📌','📎','🐔','🐍','🐢','🐛','🐝','🐜','📕','📗','📘','📙','📓','📔','📒','📚','📖','🔖','📛','🔬','🔭','📰','🎨','🎬','🎤','🎧','🎼','🎵','🎶','🎹','🎻','🎺','🎷','🎸','👾','🎮','🃏','🎴','🀄','🎲','🎯','🏈','🏀','⚽','🎾','🎱','🏉','🎳','⛳','🚵','🚴','🏁','🏇','🏆','🎿','🏂','🏊','🏄','🎣','☕','🍵','🍶','🍼','🍺','🍻','🍸','🍹','🍷','🍴','🍣','🍥','🍙','🍘','🍚','🍜','🍲','🍢','🍡','🍳','🍞','🍩','🍮','🍦','🍨','🍧','🎂','🍰','🍪','🍫','🍬','🍭','🍯','🍎','🍏','🍊','🍋','🍒','🍇','🍉','🍓','🍑','🍈','🍌','🍐','🍍','🍠','🍆','🍅','🌽','🏠','🏡','🏫','🏢','🏣','🏥','🏦','🏪','🏩','🏨','💒','⛪','🏬','🏤','🌇','🌆','🏯','🏰','⛺','🏭','🗼','🗾','🗻','🌄','🌅','🌃','🗽','🌉','🎠','🎡','⛲','🎢','🚢','⛵','🚤','🚣','⚓','🚀','✈','💺','🚁','🚂','🚊','🚉','🚞','🚆','🚄','🚅','🚈','🚇','🚝','🚋','🚃','🚎','🚌','🚍','🚙','🚘','🚗','🚕','🚖','🚛','🚚','🚨','🚓','🚔','🚒','🚑','🚐','🚲','🚡','🚟','🚠','🚜','💈','🚏','🎫','🚦','🚥','🚧','🔰','⛽','🏮','🎰','🗿','🎪','🎭','📍','🚩','🔱','🔲'];
// $random = random_int(0, 700);
return [
'maker' => $maker,
'emoji' => $emoji,
];
}
}