本文整理汇总了PHP中Eccube\Application::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::render方法的具体用法?PHP Application::render怎么用?PHP Application::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eccube\Application
的用法示例。
在下文中一共展示了Application::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
/**
* 作成ボタンクリック時の処理
* 帳票のPDFをダウンロードする
*
* @param Application $app
* @param Request $request
* @throws BadRequestHttpException
* @return \Symfony\Component\HttpFoundation\Response
*/
public function download(Application $app, Request $request)
{
// POSTでない場合は終了する
if ('POST' !== $request->getMethod()) {
throw new BadRequestHttpException();
}
$form = $app['form.factory']->createBuilder('admin_order_pdf')->getForm();
$form->handleRequest($request);
// validation
if (!$form->isValid()) {
return $app->render('OrderPdf/View/admin/order_pdf.twig', array('form' => $form->createView()));
}
// サービスの取得
$service = $app['eccube.plugin.order_pdf.service.order_pdf'];
// 購入情報からPDFを作成する
$status = $service->makePdf($form->getData());
// 異常終了した場合の処理
if (!$status) {
$service->close();
$app->addError('admin.order_pdf.download.failure', 'admin');
return $app->render('OrderPdf/View/admin/order_pdf.twig', array('form' => $form->createView()));
}
// ダウンロードする
$response = new Response($service->outputPdf(), 200, array('content-type' => 'application/pdf'));
// レスポンスヘッダーにContent-Dispositionをセットし、ファイル名をreceipt.pdfに指定
$response->headers->set('Content-Disposition', 'attachment; filename="' . $service->getPdfFileName() . '"');
return $response;
}
示例2: index
public function index(Application $app, Request $request)
{
$form = $app['form.factory']->createBuilder('plugin_Uzaitaikai_mypage_question')->getForm();
if ('POST' === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
$Question = $form['question']->getData();
return $app->render('Uzaitaikai/Resource/template/mypage/withdraw_complete.twig', array('form' => $form->createView(), 'Question' => $Question));
}
}
return $app->render('Uzaitaikai/Resource/template/mypage/withdraw.twig', array('form' => $form->createView()));
}
示例3: searchProduct
/**
* 商品検索画面を表示する
* @param Application $app
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function searchProduct(Application $app, Request $request)
{
if ($request->isXmlHttpRequest()) {
$app['monolog']->addDebug('search product start.');
$searchData = array('name' => $request->get('id'));
if ($categoryId = $request->get('category_id')) {
$Category = $app['eccube.repository.category']->find($categoryId);
$searchData['category_id'] = $Category;
}
/** @var $Products \Eccube\Entity\Product[] */
$qb = $app['eccube.repository.product']->getQueryBuilderBySearchData($searchData);
// 除外するproduct_idを設定する
$existProductId = $request->get('exist_product_id');
if (strlen($existProductId > 0)) {
$qb->andWhere($qb->expr()->notin('p.id', ':existProductId'))->setParameter('existProductId', explode(",", $existProductId));
}
$Products = $qb->getQuery()->getResult();
if (is_null($Products)) {
$app['monolog']->addDebug('search product not found.');
}
$forms = array();
foreach ($Products as $Product) {
/* @var $builder \Symfony\Component\Form\FormBuilderInterface */
$builder = $app['form.factory']->createNamedBuilder('', 'add_cart', null, array('product' => $Product));
$addCartForm = $builder->getForm();
$forms[$Product->getId()] = $addCartForm->createView();
}
return $app->render('Recommend/View/admin/search_product.twig', array('forms' => $forms, 'Products' => $Products));
}
}
示例4: index
public function index(Application $app, Request $request)
{
$email = $request->cookies->get('email');
/* @var $form \Symfony\Component\Form\FormInterface */
$form = $app['form.factory']->createNamedBuilder('', 'customer_login')->getForm();
return $app->render('Block/login.twig', array('error' => $app['security.last_error']($request), 'email' => $email, 'form' => $form->createView()));
}
示例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();
}
}
$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));
}
示例6: 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));
}
示例7: index
public function index(Application $app, Request $request)
{
$builder = $app['form.factory']->createBuilder('admin_cache');
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->get('cache')->getData();
$cacheDir = $app['config']['root_dir'] . '/app/cache';
$filesystem = new Filesystem();
foreach ($data as $dir) {
if (is_dir($cacheDir . '/' . $dir)) {
// 指定されたキャッシュディレクトリを削除
$finder = Finder::create()->in($cacheDir . '/' . $dir);
$filesystem->remove($finder);
}
if ($dir == 'doctrine') {
// doctrineが指定された場合は, cache driver経由で削除.
$config = $app['orm.em']->getConfiguration();
$this->deleteDoctrineCache($config->getMetadataCacheImpl());
$this->deleteDoctrineCache($config->getQueryCacheImpl());
$this->deleteDoctrineCache($config->getResultCacheImpl());
$this->deleteDoctrineCache($config->getHydrationCacheImpl());
}
}
$app->addSuccess('admin.content.cache.save.complete', 'admin');
}
return $app->render('Content/cache.twig', array('form' => $form->createView()));
}
示例8: 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));
}
示例9: 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));
}
示例10: index
public function index(Application $app)
{
$DeviceType = $app['eccube.repository.master.device_type']->find(DeviceType::DEVICE_TYPE_PC);
// 登録されているブロック一覧の取得
$Blocks = $app['eccube.repository.block']->getList($DeviceType);
return $app->render('Content/block.twig', array('Blocks' => $Blocks));
}
示例11: 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));
}
示例12: 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));
}
示例13: index
public function index(Application $app, Request $request, $id)
{
$repos = $app['eccube.plugin.holiday.repository.holiday'];
$TargetHoliday = new \Plugin\Holiday\Entity\Holiday();
if ($id) {
$TargetHoliday = $repos->find($id);
if (!$TargetHoliday) {
throw new NotFoundHttpException();
}
}
$form = $app['form.factory']->createBuilder('admin_holiday', $TargetHoliday)->getForm();
if ('POST' === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
$status = $repos->save($TargetHoliday);
if ($status) {
$app->addSuccess('admin.holiday.save.complete', 'admin');
return $app->redirect($app->url('admin_holiday'));
} else {
$app->addError('admin.holiday.save.error', 'admin');
}
}
}
$Holidays = $app['eccube.plugin.holiday.repository.holiday']->findAll();
return $app->render('Holiday/View/admin/holiday.twig', array('form' => $form->createView(), 'Holidays' => $Holidays, 'TargetHoliday' => $TargetHoliday));
}
示例14: index
public function index(Application $app, Request $request, $id = null)
{
if ($id) {
$TargetClassName = $app['eccube.repository.class_name']->find($id);
if (!$TargetClassName) {
throw new NotFoundHttpException();
}
} else {
$TargetClassName = new \Eccube\Entity\ClassName();
}
$builder = $app['form.factory']->createBuilder('admin_class_name', $TargetClassName);
$event = new EventArgs(array('builder' => $builder, 'TargetClassName' => $TargetClassName), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_INITIALIZE, $event);
$form = $builder->getForm();
if ($request->getMethod() === 'POST') {
$form->handleRequest($request);
if ($form->isValid()) {
$status = $app['eccube.repository.class_name']->save($TargetClassName);
if ($status) {
$event = new EventArgs(array('form' => $form, 'TargetClassName' => $TargetClassName), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_COMPLETE, $event);
$app->addSuccess('admin.class_name.save.complete', 'admin');
return $app->redirect($app->url('admin_product_class_name'));
} else {
$app->addError('admin.class_name.save.error', 'admin');
}
}
}
$ClassNames = $app['eccube.repository.class_name']->getList();
return $app->render('Product/class_name.twig', array('form' => $form->createView(), 'ClassNames' => $ClassNames, 'TargetClassName' => $TargetClassName));
}
示例15: index
/**
* 税率設定の初期表示・登録
*
* @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)
{
$TargetTaxRule = null;
if ($id == null) {
$TargetTaxRule = $app['eccube.repository.tax_rule']->newTaxRule();
} else {
$TargetTaxRule = $app['eccube.repository.tax_rule']->find($id);
if (is_null($TargetTaxRule)) {
throw new NotFoundHttpException();
}
}
/** @var $BaseInfo \Eccube\Entity\BaseInfo */
$BaseInfo = $app['eccube.repository.base_info']->get();
$builder = $app['form.factory']->createBuilder('tax_rule', $TargetTaxRule);
$builder->get('option_product_tax_rule')->setData($BaseInfo->getOptionProductTaxRule());
if ($TargetTaxRule->isDefaultTaxRule()) {
// 基本税率設定は適用日時の変更は行わない
$builder = $builder->remove('apply_date');
}
/* @var $form \Symfony\Component\Form\FormInterface */
$form = $builder->getForm();
if ('POST' === $request->getMethod()) {
$form->handleRequest($request);
if ($this->isValid($app['orm.em'], $form)) {
$app['orm.em']->persist($TargetTaxRule);
$app['orm.em']->flush();
$app->addSuccess('admin.shop.tax.save.complete', 'admin');
return $app->redirect($app->url('admin_setting_shop_tax'));
}
}
// 共通税率一覧
$TaxRules = $app['eccube.repository.tax_rule']->getList();
return $app->render('Setting/Shop/tax_rule.twig', array('TargetTaxRule' => $TargetTaxRule, 'TaxRules' => $TaxRules, 'form' => $form->createView()));
}