Completed
Push — master ( 28f97d...964a34 )
by Aimeos
03:23
created

AccountController::downloadAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 22
rs 9.2
cc 2
eloc 14
nc 2
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://www.gnu.org/copyleft/lgpl.html
5
 * @copyright Aimeos (aimeos.org), 2015-2016
6
 * @package flow
7
 * @subpackage Controller
8
 */
9
10
11
namespace Aimeos\Shop\Controller;
12
13
use TYPO3\Flow\Annotations as Flow;
14
15
16
/**
17
 * Account controller
18
 * @package flow
19
 * @subpackage Controller
20
 */
21
class AccountController extends AbstractController
22
{
23
	/**
24
	 * Returns the output of the account favorite component
25
	 *
26
	 * @return string Rendered HTML for the body
27
	 */
28
	public function favoriteComponentAction()
29
	{
30
		$this->view->assign( 'output', $this->getOutput( 'account/favorite' ) );
31
	}
32
33
34
	/**
35
	 * Returns the output of the account history component
36
	 *
37
	 * @return string Rendered HTML for the body
38
	 */
39
	public function historyComponentAction()
40
	{
41
		$this->view->assign( 'output', $this->getOutput( 'account/history' ) );
42
	}
43
44
45
	/**
46
	 * Returns the output of the account watch component
47
	 *
48
	 * @return string Rendered HTML for the body
49
	 */
50
	public function watchComponentAction()
51
	{
52
		$this->view->assign( 'output', $this->getOutput( 'account/watch' ) );
53
	}
54
55
56
	/**
57
	 * Content for MyAccount page
58
	 *
59
	 * @Flow\Session(autoStart = TRUE)
60
	 */
61
	public function indexAction()
62
	{
63
		$this->view->assignMultiple( $this->getSections( 'account-index' ) );
64
	}
65
66
67
	/**
68
	 * Content for MyAccount download page
69
	 *
70
	 * @Flow\Session(autoStart = TRUE)
71
	 */
72
	public function downloadAction()
73
	{
74
		$context = app( '\Aimeos\Shop\Base\Context' )->get();
75
		$langid = $context->getLocale()->getLanguageId();
76
77
		$view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), array(), $langid );
78
		$context->setView( $view );
79
80
		$client = \Aimeos\Client\Html\Factory::createClient( $context, array(), 'account/download' );
81
		$client->setView( $view );
82
		$client->process();
83
84
		$response = $view->response();
85
		$flowResponse = \TYPO3\Flow\Http\Response::createFromRaw( (string) $response->getBody() );
86
		$flowResponse->setStatus( $response->getStatusCode() );
87
88
		foreach( $response->getHeaders() as $key => $value ) {
89
			$flowResponse->setHeader( $key, $value );
90
		}
91
92
		return $flowResponse;
93
	}
94
}
95