1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2016 |
6
|
|
|
* @package Slim |
7
|
|
|
* @subpackage Controller |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Aimeos\Slim\Controller; |
11
|
|
|
|
12
|
|
|
use Psr\Container\ContainerInterface; |
13
|
|
|
use Psr\Http\Message\ServerRequestInterface; |
14
|
|
|
use Psr\Http\Message\ResponseInterface; |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Aimeos controller for account related functionality. |
19
|
|
|
* |
20
|
|
|
* @package Slim |
21
|
|
|
* @subpackage Controller |
22
|
|
|
*/ |
23
|
|
|
class Account |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Returns the html for the "My account" page. |
27
|
|
|
* |
28
|
|
|
* @param ContainerInterface $container Dependency injection container |
29
|
|
|
* @param ServerRequestInterface $request Request object |
30
|
|
|
* @param ResponseInterface $response Response object |
31
|
|
|
* @param array $args Associative list of route parameters |
32
|
|
|
* @return ResponseInterface $response Modified response object with generated output |
33
|
|
|
*/ |
34
|
|
|
public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, |
35
|
|
|
ResponseInterface $response, array $args ) : ResponseInterface |
36
|
|
|
{ |
37
|
|
|
$contents = $container->get( 'shop' )->get( 'account-index', $request, $response, $args ); |
38
|
|
|
return $container->get( 'view' )->render( $response, 'Account/index.html.twig', $contents ); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Returns the html for the "My account" download page. |
44
|
|
|
* |
45
|
|
|
* @param ContainerInterface $container Dependency injection container |
46
|
|
|
* @param ServerRequestInterface $request Request object |
47
|
|
|
* @param ResponseInterface $response Response object |
48
|
|
|
* @param array $args Associative list of route parameters |
49
|
|
|
* @return ResponseInterface $response Modified response object with generated output |
50
|
|
|
*/ |
51
|
|
|
public static function downloadAction( ContainerInterface $container, ServerRequestInterface $request, |
52
|
|
|
ResponseInterface $response, array $args ) : ResponseInterface |
53
|
|
|
{ |
54
|
|
|
$context = $container->get( 'aimeos.context' )->get( true, $args ); |
55
|
|
|
$langid = $context->getLocale()->getLanguageId(); |
56
|
|
|
|
57
|
|
|
$view = $container->get( 'aimeos.view' )->create( $context, $request, $response, $args, array(), $langid ); |
58
|
|
|
$context->setView( $view ); |
59
|
|
|
|
60
|
|
|
$client = \Aimeos\Client\Html::create( $context, 'account/download' ); |
61
|
|
|
$client->setView( $view ); |
62
|
|
|
$client->process(); |
63
|
|
|
|
64
|
|
|
return $view->response(); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|