public function imageAdd(Application $app, Request $request) { $images = $request->files->get('payment_register'); $filename = null; if (isset($images['payment_image_file'])) { $image = $images['payment_image_file']; $extension = $image->guessExtension(); $filename = date('mdHis') . uniqid('_') . '.' . $extension; $image->move($app['config']['image_temp_realdir'], $filename); } return $app->json(array('filename' => $filename), 200); }
public function addImage(Application $app, Request $request) { if (!$request->isXmlHttpRequest()) { throw new BadRequestHttpException(); } $images = $request->files->get('admin_product'); $files = array(); if (count($images) > 0) { foreach ($images as $img) { foreach ($img as $image) { //ファイルフォーマット検証 $mimeType = $image->getMimeType(); if (0 !== strpos($mimeType, 'image')) { throw new UnsupportedMediaTypeHttpException(); } $extension = $image->getClientOriginalExtension(); $filename = date('mdHis') . uniqid('_') . '.' . $extension; $image->move($app['config']['image_temp_realdir'], $filename); $files[] = $filename; } } } $event = new EventArgs(array('images' => $images, 'files' => $files), $request); $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_ADD_IMAGE_COMPLETE, $event); $files = $event->getArgument('files'); return $app->json(array('files' => $files), 200); }
/** * 顧客情報を検索する. * * @param Application $app * @param Request $request * @return \Symfony\Component\HttpFoundation\JsonResponse */ public function searchCustomerById(Application $app, Request $request) { if ($request->isXmlHttpRequest()) { $app['monolog']->addDebug('search customer by id start.'); /** @var $Customer \Eccube\Entity\Customer */ $Customer = $app['eccube.repository.customer']->find($request->get('id')); if (is_null($Customer)) { $app['monolog']->addDebug('search customer by id not found.'); return $app->json(array(), 404); } $app['monolog']->addDebug('search customer by id found.'); $data = array('id' => $Customer->getId(), 'name01' => $Customer->getName01(), 'name02' => $Customer->getName02(), 'kana01' => $Customer->getKana01(), 'kana02' => $Customer->getKana02(), 'zip01' => $Customer->getZip01(), 'zip02' => $Customer->getZip02(), 'pref' => is_null($Customer->getPref()) ? null : $Customer->getPref()->getId(), 'addr01' => $Customer->getAddr01(), 'addr02' => $Customer->getAddr02(), 'email' => $Customer->getEmail(), 'tel01' => $Customer->getTel01(), 'tel02' => $Customer->getTel02(), 'tel03' => $Customer->getTel03(), 'fax01' => $Customer->getFax01(), 'fax02' => $Customer->getFax02(), 'fax03' => $Customer->getFax03(), 'company_name' => $Customer->getCompanyName()); return $app->json($data); } }
public function addImage(Application $app, Request $request) { $images = $request->files->get('admin_product'); $files = array(); if (count($images) > 0) { foreach ($images as $img) { foreach ($img as $image) { $extension = $image->getClientOriginalExtension(); $filename = date('mdHis') . uniqid('_') . '.' . $extension; $image->move($app['config']['image_temp_realdir'], $filename); $files[] = $filename; } } } return $app->json(array('files' => $files), 200); }
function ajax(Application $app, Request $request) { //if (! $request->isXmlHttpRequest()) { // return ""; //} $latestHistoryId = (int) $app['request']->get('latest'); switch ($app['request']->get('type')) { case 'list': if ($latestHistoryId > 0) { $groups = $app['eccube.plugin.customer_tracker.repository.history']->getLatestHistoryGroups($latestHistoryId); } else { $timeRange = (int) $app['request']->get('timerange'); $groups = $app['eccube.plugin.customer_tracker.repository.history']->getGroupedHistory($timeRange); } // change groups to array if ($groups) { foreach ($groups as $key => $histories) { $data = array(); foreach ($histories as $history) { $data[] = $history->getDataArray(); } $groups[$key] = $data; } } return $app->json($groups); case 'force': if ($latestHistoryId > 0) { $groupedHistory = $app['eccube.plugin.customer_tracker.repository.history']->getLatestHistoryGroups($latestHistoryId); } else { $timeRange = (int) $app['request']->get('timerange'); $groupedHistory = $app['eccube.plugin.customer_tracker.repository.history']->getGroupedHistory($timeRange); } if (sizeof($groupedHistory) > 0) { $latestHistory = array_values($groupedHistory)[0][0]; } $relations = $app['eccube.plugin.customer_tracker.repository.history']->getUriRelations($groupedHistory); if ($latestHistory) { $relations['latestHistoryId'] = $latestHistory->getId(); } return $app->json($relations); } return ""; }
/** * 顧客情報を検索する. * * @param Application $app * @param Request $request * @return \Symfony\Component\HttpFoundation\JsonResponse */ public function searchCustomerById(Application $app, Request $request) { if ($request->isXmlHttpRequest()) { $app['monolog']->addDebug('search customer by id start.'); /** @var $Customer \Eccube\Entity\Customer */ $Customer = $app['eccube.repository.customer']->find($request->get('id')); $event = new EventArgs(array('Customer' => $Customer), $request); $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_BY_ID_INITIALIZE, $event); if (is_null($Customer)) { $app['monolog']->addDebug('search customer by id not found.'); return $app->json(array(), 404); } $app['monolog']->addDebug('search customer by id found.'); $data = array('id' => $Customer->getId(), 'name01' => $Customer->getName01(), 'name02' => $Customer->getName02(), 'kana01' => $Customer->getKana01(), 'kana02' => $Customer->getKana02(), 'zip01' => $Customer->getZip01(), 'zip02' => $Customer->getZip02(), 'pref' => is_null($Customer->getPref()) ? null : $Customer->getPref()->getId(), 'addr01' => $Customer->getAddr01(), 'addr02' => $Customer->getAddr02(), 'email' => $Customer->getEmail(), 'tel01' => $Customer->getTel01(), 'tel02' => $Customer->getTel02(), 'tel03' => $Customer->getTel03(), 'fax01' => $Customer->getFax01(), 'fax02' => $Customer->getFax02(), 'fax03' => $Customer->getFax03(), 'company_name' => $Customer->getCompanyName()); $event = new EventArgs(array('data' => $data, 'Customer' => $Customer), $request); $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_BY_ID_COMPLETE, $event); $data = $event->getArgument('data'); return $app->json($data); } }
public function imageAdd(Application $app, Request $request) { if (!$request->isXmlHttpRequest()) { throw new BadRequestHttpException(); } $images = $request->files->get('payment_register'); $filename = null; if (isset($images['payment_image_file'])) { $image = $images['payment_image_file']; //ファイルフォーマット検証 $mimeType = $image->getMimeType(); if (0 !== strpos($mimeType, 'image')) { throw new UnsupportedMediaTypeHttpException(); } $extension = $image->guessExtension(); $filename = date('mdHis') . uniqid('_') . '.' . $extension; $image->move($app['config']['image_temp_realdir'], $filename); } $event = new EventArgs(array('images' => $images, 'filename' => $filename), $request); $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_PAYMENT_IMAGE_ADD_COMPLETE, $event); $filename = $event->getArgument('filename'); return $app->json(array('filename' => $filename), 200); }