1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license MIT, http://opensource.org/licenses/MIT |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2016 |
6
|
|
|
* @package symfony |
7
|
|
|
* @subpackage Controller |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\ShopBundle\Controller; |
12
|
|
|
|
13
|
|
|
use Symfony\Component\HttpFoundation\Response; |
14
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Aimeos controller for account related functionality. |
19
|
|
|
* |
20
|
|
|
* @package symfony |
21
|
|
|
* @subpackage Controller |
22
|
|
|
*/ |
23
|
|
|
class AccountController extends Controller |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Returns the html for the "My account" page. |
27
|
|
|
* |
28
|
|
|
* @return Response Response object containing the generated output |
29
|
|
|
*/ |
30
|
|
|
public function indexAction() : Response |
31
|
|
|
{ |
32
|
|
|
$params = []; |
33
|
|
|
$shop = $this->container->get( 'shop' ); |
34
|
|
|
|
35
|
|
|
foreach( $this->container->getParameter( 'aimeos_shop.page' )['account-index'] as $name ) |
36
|
|
|
{ |
37
|
|
|
$params['aiheader'][$name] = $shop->get( $name )->getHeader(); |
38
|
|
|
$params['aibody'][$name] = $shop->get( $name )->getBody(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$response = $this->render( '@AimeosShop/Account/index.html.twig', $params ); |
42
|
|
|
$response->headers->set( 'Cache-Control', 'no-store' ); |
43
|
|
|
return $response; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Returns the html for the "My account" download page. |
49
|
|
|
* |
50
|
|
|
* @return Response Response object containing the generated output |
51
|
|
|
*/ |
52
|
|
|
public function downloadAction() : Response |
53
|
|
|
{ |
54
|
|
|
$response = $this->container->get( 'shop' )->get( 'account/download' )->getView()->response(); |
55
|
|
|
return Response::create( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() ); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Returns the output of the account favorite component |
61
|
|
|
* |
62
|
|
|
* @return Response Response object containing the generated output |
63
|
|
|
*/ |
64
|
|
|
public function favoriteComponentAction() : Response |
65
|
|
|
{ |
66
|
|
|
$client = $this->container->get( 'shop' )->get( 'account/favorite' ); |
67
|
|
|
$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
68
|
|
|
|
69
|
|
|
return new Response( (string) $client->getBody() ); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Returns the output of the account history component |
75
|
|
|
* |
76
|
|
|
* @return Response Response object containing the generated output |
77
|
|
|
*/ |
78
|
|
|
public function historyComponentAction() : Response |
79
|
|
|
{ |
80
|
|
|
$client = $this->container->get( 'shop' )->get( 'account/history' ); |
81
|
|
|
$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
82
|
|
|
|
83
|
|
|
return new Response( (string) $client->getBody() ); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Returns the output of the account profile component |
89
|
|
|
* |
90
|
|
|
* @return Response Response object containing the generated output |
91
|
|
|
*/ |
92
|
|
|
public function profileComponentAction() : Response |
93
|
|
|
{ |
94
|
|
|
$client = $this->container->get( 'shop' )->get( 'account/profile' ); |
95
|
|
|
$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
96
|
|
|
|
97
|
|
|
return new Response( (string) $client->getBody() ); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Returns the output of the account watch component |
103
|
|
|
* |
104
|
|
|
* @return Response Response object containing the generated output |
105
|
|
|
*/ |
106
|
|
|
public function watchComponentAction() : Response |
107
|
|
|
{ |
108
|
|
|
$client = $this->container->get( 'shop' )->get( 'account/watch' ); |
109
|
|
|
$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
110
|
|
|
|
111
|
|
|
return new Response( (string) $client->getBody() ); |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|