本文整理汇总了PHP中Eccube\Application::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::url方法的具体用法?PHP Application::url怎么用?PHP Application::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eccube\Application
的用法示例。
在下文中一共展示了Application::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index(Application $app, Request $request, $id = null)
{
$Mail = null;
if ($id) {
$Mail = $app['orm.em']->getRepository('\\Eccube\\Entity\\MailTemplate')->find($id);
if (is_null($Mail)) {
throw new NotFoundHttpException();
}
}
$builder = $app['form.factory']->createBuilder('mail', $Mail);
$event = new EventArgs(array('builder' => $builder, 'Mail' => $Mail), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_MAIL_INDEX_INITIALIZE, $event);
$form = $builder->getForm();
$form['template']->setData($Mail);
if ('POST' === $request->getMethod()) {
$form->handleRequest($request);
// 新規登録は現時点では未実装とする.
if (is_null($Mail)) {
$app->addError('admin.shop.mail.save.error', 'admin');
return $app->redirect($app->url('admin_setting_shop_mail'));
}
if ($form->isValid()) {
$app['orm.em']->flush();
$event = new EventArgs(array('form' => $form, 'Mail' => $Mail), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_MAIL_INDEX_COMPLETE, $event);
$app->addSuccess('admin.shop.mail.save.complete', 'admin');
return $app->redirect($app->url('admin_setting_shop_mail_edit', array('id' => $id)));
}
}
return $app->render('Setting/Shop/mail.twig', array('form' => $form->createView(), 'id' => $id));
}
示例2: edit
/**
* edit
*
* @param Application $app
* @request Symfony\Component\HttpFoundation\Request $app
* @return mixed
*/
public function edit(Application $app, Request $request, $id = null)
{
$Customer = $app['user'];
$CustomerAddress = $app['eccube.repository.customer_address']->findOrCreateByCustomerAndId($Customer, $id);
$parentPage = $request->get('parent_page', null);
// 正しい遷移かをチェック
$allowdParents = array($app->url('mypage_delivery'), $app->url('shopping_delivery'));
// 遷移が正しくない場合、デフォルトであるマイページの配送先追加の画面を設定する
if (!in_array($parentPage, $allowdParents)) {
$parentPage = $app->url('mypage_delivery');
}
/* @var $form \Symfony\Component\Form\FormInterface */
$form = $app['form.factory']->createBuilder('customer_address', $CustomerAddress)->getForm();
if ($request->getMethod() === 'POST') {
$form->handleRequest($request);
if ($form->isValid()) {
$app['orm.em']->persist($CustomerAddress);
$app['orm.em']->flush();
$app->addSuccess('mypage.delivery.add.complete');
return $app->redirect($app->url('mypage_delivery'));
}
}
$BaseInfo = $app['eccube.repository.base_info']->get();
return $app->render('Mypage/delivery_edit.twig', array('form' => $form->createView(), 'parentPage' => $parentPage, 'BaseInfo' => $BaseInfo));
}
示例3: edit
/**
* edit
*
* @param Application $app
* @request Symfony\Component\HttpFoundation\Request $app
* @return mixed
*/
public function edit(Application $app, Request $request, $id = null)
{
$Customer = $app['user'];
// 配送先住所最大値判定
// $idが存在する際は、追加処理ではなく、編集の処理ため本ロジックスキップ
if (is_null($id)) {
$addressCurrNum = count($Customer->getCustomerAddresses());
$addressMax = $app['config']['deliv_addr_max'];
if ($addressCurrNum >= $addressMax) {
throw new NotFoundHttpException();
}
}
$CustomerAddress = $app['eccube.repository.customer_address']->findOrCreateByCustomerAndId($Customer, $id);
$parentPage = $request->get('parent_page', null);
// 正しい遷移かをチェック
$allowdParents = array($app->url('mypage_delivery'), $app->url('shopping_delivery'));
// 遷移が正しくない場合、デフォルトであるマイページの配送先追加の画面を設定する
if (!in_array($parentPage, $allowdParents)) {
$parentPage = $app->url('mypage_delivery');
}
/* @var $form \Symfony\Component\Form\FormInterface */
$form = $app['form.factory']->createBuilder('customer_address', $CustomerAddress)->getForm();
if ($request->getMethod() === 'POST') {
$form->handleRequest($request);
if ($form->isValid()) {
$app['orm.em']->persist($CustomerAddress);
$app['orm.em']->flush();
$app->addSuccess('mypage.delivery.add.complete');
return $app->redirect($app->url('mypage_delivery'));
}
}
$BaseInfo = $app['eccube.repository.base_info']->get();
return $app->render('Mypage/delivery_edit.twig', array('form' => $form->createView(), 'parentPage' => $parentPage, 'BaseInfo' => $BaseInfo));
}
示例4: index
public function index(Application $app, Request $request, $parent_id = null, $id = null)
{
if ($parent_id) {
$Parent = $app['eccube.repository.category']->find($parent_id);
if (!$Parent) {
throw new NotFoundHttpException('親カテゴリが存在しません');
}
} else {
$Parent = null;
}
if ($id) {
$TargetCategory = $app['eccube.repository.category']->find($id);
if (!$TargetCategory) {
throw new NotFoundHttpException('カテゴリが存在しません');
}
$Parent = $TargetCategory->getParent();
} else {
$TargetCategory = new \Eccube\Entity\Category();
$TargetCategory->setParent($Parent);
if ($Parent) {
$TargetCategory->setLevel($Parent->getLevel() + 1);
} else {
$TargetCategory->setLevel(1);
}
}
//
$builder = $app['form.factory']->createBuilder('admin_category', $TargetCategory);
$event = new EventArgs(array('builder' => $builder, 'Parent' => $Parent, 'TargetCategory' => $TargetCategory), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_INDEX_INITIALIZE, $event);
$form = $builder->getForm();
//
if ($request->getMethod() === 'POST') {
$form->handleRequest($request);
if ($form->isValid()) {
if ($app['config']['category_nest_level'] < $TargetCategory->getLevel()) {
throw new BadRequestHttpException('リクエストが不正です');
}
log_info('カテゴリ登録開始', array($id));
$status = $app['eccube.repository.category']->save($TargetCategory);
if ($status) {
log_info('カテゴリ登録完了', array($id));
$event = new EventArgs(array('form' => $form, 'Parent' => $Parent, 'TargetCategory' => $TargetCategory), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_INDEX_COMPLETE, $event);
$app->addSuccess('admin.category.save.complete', 'admin');
if ($Parent) {
return $app->redirect($app->url('admin_product_category_show', array('parent_id' => $Parent->getId())));
} else {
return $app->redirect($app->url('admin_product_category'));
}
} else {
log_info('カテゴリ登録エラー', array($id));
$app->addError('admin.category.save.error', 'admin');
}
}
}
$Categories = $app['eccube.repository.category']->getList($Parent);
// ツリー表示のため、ルートからのカテゴリを取得
$TopCategories = $app['eccube.repository.category']->getList(null);
return $app->render('Product/category.twig', array('form' => $form->createView(), 'Parent' => $Parent, 'Categories' => $Categories, 'TopCategories' => $TopCategories, 'TargetCategory' => $TargetCategory));
}
示例5: index
public function index(Application $app, Request $request, $id = null)
{
$Mail = null;
if ($id) {
$Mail = $app['orm.em']->getRepository('\\Eccube\\Entity\\MailTemplate')->find($id);
if (is_null($Mail)) {
throw new NotFoundHttpException();
}
}
$form = $app['form.factory']->createBuilder('mail', $Mail)->getForm();
$form['template']->setData($Mail);
if ('POST' === $request->getMethod()) {
$form->handleRequest($request);
// 新規登録は現時点では未実装とする.
if (is_null($Mail)) {
$app->addError('admin.shop.mail.save.error', 'admin');
return $app->redirect($app->url('admin_setting_shop_mail'));
}
if ($form->isValid()) {
$app['orm.em']->flush();
$app->addSuccess('admin.shop.mail.save.complete', 'admin');
return $app->redirect($app->url('admin_setting_shop_mail_edit', array('id' => $id)));
}
}
return $app->render('Setting/Shop/mail.twig', array('form' => $form->createView(), 'id' => $id));
}
示例6: index
public function index(Application $app, Request $request, $parent_id = null, $id = null)
{
if ($parent_id) {
$Parent = $app['eccube.repository.category']->find($parent_id);
if (!$Parent) {
throw new NotFoundHttpException();
}
} else {
$Parent = null;
}
if ($id) {
$TargetCategory = $app['eccube.repository.category']->find($id);
if (!$TargetCategory) {
throw new NotFoundHttpException();
}
$Parent = $TargetCategory->getParent();
} else {
$TargetCategory = new \Eccube\Entity\Category();
$TargetCategory->setParent($Parent);
if ($Parent) {
$TargetCategory->setLevel($Parent->getLevel() + 1);
} else {
$TargetCategory->setLevel(1);
}
}
//
$form = $app['form.factory']->createBuilder('admin_category', $TargetCategory)->getForm();
//
if ($request->getMethod() === 'POST') {
$form->handleRequest($request);
if ($form->isValid()) {
if ($app['config']['category_nest_level'] < $TargetCategory->getLevel()) {
throw new BadRequestHttpException();
}
$status = $app['eccube.repository.category']->save($TargetCategory);
if ($status) {
$app->addSuccess('admin.category.save.complete', 'admin');
if ($Parent) {
return $app->redirect($app->url('admin_product_category_show', array('parent_id' => $Parent->getId())));
} else {
return $app->redirect($app->url('admin_product_category'));
}
} else {
$app->addError('admin.category.save.error', 'admin');
}
}
}
$Children = $app['eccube.repository.category']->getList(null);
$Categories = $app['eccube.repository.category']->getList($Parent);
$TopCategories = $app['eccube.repository.category']->findBy(array('Parent' => null), array('rank' => 'DESC'));
$category_count = $app['eccube.repository.category']->getTotalCount();
return $app->render('Product/category.twig', array('form' => $form->createView(), 'Children' => $Children, 'Parent' => $Parent, 'Categories' => $Categories, 'TopCategories' => $TopCategories, 'TargetCategory' => $TargetCategory, 'category_count' => $category_count));
}
示例7: __construct
/**
* AdContents constructor.
* @param Application $app
* @param Product $product
*/
public function __construct(Application $app, Product $product)
{
$shop_name = $app['eccube.repository.base_info']->get()->getShopName();
$homepage_url = $app->url('homepage');
$product_url = $app->url('product_detail', array('id' => $product->getId()));
$this->headline = CsvContentsUtil::clipText($product->getName(), 15);
$this->description1 = CsvContentsUtil::clipText($product->getDescriptionDetail(), 19);
$this->description2 = CsvContentsUtil::clipText($shop_name, 19);
$this->display_url = CsvContentsUtil::removeHttpText(CsvContentsUtil::clipText($homepage_url, 29));
$this->link_url = CsvContentsUtil::clipText($product_url, 1024);
$now = new \DateTime();
$ad_name = $now->format('Ymd') . '_' . str_pad($product->getId(), 4, 0, STR_PAD_LEFT);
$this->ad_inner_name = CsvContentsUtil::clipText($ad_name, 50);
}
示例8: index
/**
* お問い合わせ画面.
*
* @param Application $app
* @param Request $request
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function index(Application $app, Request $request)
{
$builder = $app['form.factory']->createBuilder('contact');
if ($app->isGranted('ROLE_USER')) {
$user = $app['user'];
$builder->setData(array('name01' => $user->getName01(), 'name02' => $user->getName02(), 'kana01' => $user->getKana01(), 'kana02' => $user->getKana02(), 'zip01' => $user->getZip01(), 'zip02' => $user->getZip02(), 'pref' => $user->getPref(), 'addr01' => $user->getAddr01(), 'addr02' => $user->getAddr02(), 'tel01' => $user->getTel01(), 'tel02' => $user->getTel02(), 'tel03' => $user->getTel03(), 'email' => $user->getEmail()));
}
// FRONT_CONTACT_INDEX_INITIALIZE
$event = new EventArgs(array('builder' => $builder), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CONTACT_INDEX_INITIALIZE, $event);
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
switch ($request->get('mode')) {
case 'confirm':
$builder->setAttribute('freeze', true);
$form = $builder->getForm();
$form->handleRequest($request);
$title = 'お問い合わせ(確認ページ)';
return $app->render('Contact/confirm.twig', array('form' => $form->createView(), 'title' => $title));
case 'complete':
$data = $form->getData();
$event = new EventArgs(array('form' => $form, 'data' => $data), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CONTACT_INDEX_COMPLETE, $event);
$data = $event->getArgument('data');
// メール送信
$app['eccube.service.mail']->sendContactMail($data);
return $app->redirect($app->url('contact_complete'));
}
}
return $app->render('Contact/index.twig', array('form' => $form->createView()));
}
示例9: index
/**
* 納品書の設定画面表示.
*
* @param Application $app
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
*
* @throws NotFoundHttpException
*/
public function index(Application $app, Request $request)
{
// requestから受注番号IDの一覧を取得する.
$ids = $this->getIds($request);
if (count($ids) == 0) {
$app->addError('admin.plugin.order_pdf.parameter.notfound', 'admin');
log_info('The Order cannot found!');
return $app->redirect($app->url('admin_order'));
}
/* @var OrderPdfRepository $repos */
$repos = $app['orderpdf.repository.order_pdf'];
$OrderPdf = $repos->find($app->user());
if (EntityUtil::isEmpty($OrderPdf)) {
$OrderPdf = new OrderPdf();
$OrderPdf->setTitle($app->trans('admin.plugin.order_pdf.title.default'))->setMessage1($app->trans('admin.plugin.order_pdf.message1.default'))->setMessage2($app->trans('admin.plugin.order_pdf.message2.default'))->setMessage3($app->trans('admin.plugin.order_pdf.message3.default'));
}
/**
* @var FormBuilder $builder
*/
$builder = $app['form.factory']->createBuilder('admin_order_pdf', $OrderPdf);
/* @var Form $form */
$form = $builder->getForm();
// Formへの設定
$form->get('ids')->setData(implode(',', $ids));
return $app->render('OrderPdf/Resource/template/admin/order_pdf.twig', array('form' => $form->createView()));
}
示例10: index
public function index(Application $app, Request $request, $id)
{
$repos = $app['eccube.plugin.holiday.repository.holidayweek'];
$TargetHolidayWeek = new \Plugin\Holiday\Entity\HolidayWeek();
if ($id) {
$TargetHolidayWeek = $repos->find($id);
if (!$TargetHolidayWeek) {
throw new NotFoundHttpException();
}
$TargetHolidayWeek->week = unserialize($TargetHolidayWeek->week);
}
$form = $app['form.factory']->createBuilder('admin_holiday_week', $TargetHolidayWeek)->getForm();
if ('POST' === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
// 取得した曜日選択情報をシリアライズ
$TargetHolidayWeek->week = serialize($TargetHolidayWeek->week);
$status = $repos->save($TargetHolidayWeek);
if ($status) {
$app->addSuccess('admin.holiday.save.complete', 'admin');
return $app->redirect($app->url('admin_holiday_week'));
} else {
$app->addError('admin.holiday.save.error', 'admin');
}
}
}
return $app->render('Holiday/View/admin/week.twig', array('form' => $form->createView(), 'TargetHolidayWeek' => $TargetHolidayWeek));
}
示例11: edit
public function edit(Application $app, $id = null)
{
$Payment = $app['eccube.repository.payment']->findOrCreate($id);
$form = $app['form.factory']->createBuilder('payment_register')->getForm();
$form->setData($Payment);
// 登録ボタン押下
if ('POST' === $app['request']->getMethod()) {
$form->handleRequest($app['request']);
if ($form->isValid()) {
$PaymentData = $form->getData();
// 手数料を設定できない場合には、手数料を0にする
if ($PaymentData->getChargeFlg() == 2) {
$PaymentData->setCharge(0);
}
// ファイルアップロード
$file = $form['payment_image']->getData();
$fs = new Filesystem();
if ($file && $fs->exists($app['config']['image_temp_realdir'] . '/' . $file)) {
$fs->rename($app['config']['image_temp_realdir'] . '/' . $file, $app['config']['image_save_realdir'] . '/' . $file);
}
$app['orm.em']->persist($PaymentData);
$app['orm.em']->flush();
$app->addSuccess('admin.register.complete', 'admin');
return $app->redirect($app->url('admin_setting_shop_payment'));
}
}
return $app->render('Setting/Shop/payment_edit.twig', array('form' => $form->createView(), 'payment_id' => $id, 'Payment' => $Payment));
}
示例12: onControllerShoppingConfirmBefore
/**
* クーポンが利用されていないかチェック
*
*/
public function onControllerShoppingConfirmBefore($event = null)
{
$cartService = $this->app['eccube.service.cart'];
$preOrderId = $cartService->getPreOrderId();
if (is_null($preOrderId)) {
return;
}
$repository = $this->app['eccube.plugin.coupon.repository.coupon_order'];
// クーポン受注情報を取得する
$CouponOrder = $repository->findOneBy(array('pre_order_id' => $preOrderId));
if (!$CouponOrder) {
return;
}
if ($this->app->isGranted('ROLE_USER')) {
$Customer = $this->app->user();
} else {
$Customer = $this->app['eccube.service.shopping']->getNonMember($this->sessionKey);
}
// クーポンが既に利用されているかチェック
$couponUsedOrNot = $this->app['eccube.plugin.coupon.service.coupon']->checkCouponUsedOrNotBefore($CouponOrder->getCouponCd(), $CouponOrder->getOrderId(), $Customer);
if ($couponUsedOrNot) {
$this->app->addError($this->app->trans('front.plugin.coupon.shopping.sameuser'), 'front.request');
// 既に存在している
if (is_null($event)) {
header("Location: " . $this->app->url('shopping'));
exit;
} else {
$response = $this->redirect($this->app->url('shopping'));
$event->setResponse($response);
return;
}
}
}
示例13: edit
/**
* 新着情報を登録・編集する。
*
* @param Application $app
* @param Request $request
* @param integer $id
* @throws NotFoundHttpException
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function edit(Application $app, Request $request, $id = null)
{
if ($id) {
$News = $app['eccube.repository.news']->find($id);
if (!$News) {
throw new NotFoundHttpException();
}
$News->setLinkMethod((bool) $News->getLinkMethod());
} else {
$News = new \Eccube\Entity\News();
}
$form = $app['form.factory']->createBuilder('admin_news', $News)->getForm();
if ('POST' === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
$data = $form->getData();
if (empty($data['url'])) {
$News->setLinkMethod(Constant::DISABLED);
}
$status = $app['eccube.repository.news']->save($News);
if ($status) {
$app->addSuccess('admin.news.save.complete', 'admin');
return $app->redirect($app->url('admin_content_news'));
}
$app->addError('admin.news.save.error', 'admin');
}
}
return $app->render('Content/news_edit.twig', array('form' => $form->createView(), 'News' => $News));
}
示例14: index
/**
* List, add, edit maker.
*
* @param Application $app
* @param Request $request
* @param null $id
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function index(Application $app, Request $request, $id = null)
{
$repos = $app['eccube.plugin.maker.repository.maker'];
$TargetMaker = new Maker();
if ($id) {
$TargetMaker = $repos->find($id);
if (!$TargetMaker) {
log_error('The Maker not found!', array('Maker id' => $id));
throw new NotFoundHttpException();
}
}
$form = $app['form.factory']->createBuilder('admin_maker', $TargetMaker)->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
log_info('Maker add/edit start.');
$status = $repos->save($TargetMaker);
if ($status) {
log_info('Maker add/edit success', array('Maker id' => $TargetMaker->getId()));
$app->addSuccess('admin.plugin.maker.save.complete', 'admin');
return $app->redirect($app->url('admin_plugin_maker_index'));
} else {
log_info('Maker add/edit fail!', array('Maker id' => $TargetMaker->getId()));
$app->addError('admin.plugin.maker.save.error', 'admin');
}
}
/**
* @var ArrayCollection $arrMaker
*/
$arrMaker = $app['eccube.plugin.maker.repository.maker']->findBy(array(), array('rank' => 'DESC'));
return $app->render('Maker/Resource/template/admin/maker.twig', array('form' => $form->createView(), 'arrMaker' => $arrMaker, 'TargetMaker' => $TargetMaker));
}
示例15: index
public function index(Application $app, Request $request, $class_name_id, $id = null)
{
//
$ClassName = $app['eccube.repository.class_name']->find($class_name_id);
if (!$ClassName) {
throw new NotFoundHttpException();
}
if ($id) {
$TargetClassCategory = $app['eccube.repository.class_category']->find($id);
if (!$TargetClassCategory || $TargetClassCategory->getClassName() != $ClassName) {
throw new NotFoundHttpException();
}
} else {
$TargetClassCategory = new \Eccube\Entity\ClassCategory();
$TargetClassCategory->setClassName($ClassName);
}
//
$form = $app['form.factory']->createBuilder('admin_class_category', $TargetClassCategory)->getForm();
if ($request->getMethod() === 'POST') {
$form->handleRequest($request);
if ($form->isValid()) {
$status = $app['eccube.repository.class_category']->save($TargetClassCategory);
if ($status) {
$app->addSuccess('admin.class_category.save.complete', 'admin');
return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId())));
} else {
$app->addError('admin.class_category.save.error', 'admin');
}
}
}
$ClassCategories = $app['eccube.repository.class_category']->getList($ClassName);
return $app->render('Product/class_category.twig', array('form' => $form->createView(), 'ClassName' => $ClassName, 'ClassCategories' => $ClassCategories, 'TargetClassCategory' => $TargetClassCategory));
}