1313
1414namespace phpbb \install \controller ;
1515
16+ use phpbb \install \helper \config ;
17+ use phpbb \install \helper \navigation \navigation_provider ;
1618use Symfony \Component \HttpFoundation \StreamedResponse ;
19+ use Symfony \Component \HttpFoundation \Response ;
20+ use phpbb \install \helper \iohandler \factory ;
21+ use phpbb \install \controller \helper ;
22+ use phpbb \template \template ;
23+ use phpbb \request \request_interface ;
24+ use phpbb \install \installer ;
25+ use phpbb \language \language ;
1726
1827/**
1928 * Controller for installing phpBB
2029 */
2130class install
2231{
2332 /**
24- * @var \phpbb\install\controller\ helper
33+ * @var helper
2534 */
2635 protected $ controller_helper ;
2736
2837 /**
29- * @var \phpbb\install\helper\iohandler\factory
38+ * @var config
39+ */
40+ protected $ installer_config ;
41+
42+ /**
43+ * @var factory
3044 */
3145 protected $ iohandler_factory ;
3246
3347 /**
34- * @var \phpbb\template\template
48+ * @var navigation_provider
49+ */
50+ protected $ menu_provider ;
51+
52+ /**
53+ * @var language
54+ */
55+ protected $ language ;
56+
57+ /**
58+ * @var template
3559 */
3660 protected $ template ;
3761
3862 /**
39- * @var \phpbb\request\ request_interface
63+ * @var request_interface
4064 */
4165 protected $ request ;
4266
4367 /**
44- * @var \phpbb\install\ installer
68+ * @var installer
4569 */
4670 protected $ installer ;
4771
4872 /**
4973 * Constructor
5074 *
51- * @param helper $helper
52- * @param \phpbb\install\helper\iohandler\factory $factory
53- * @param \phpbb\request\request_interface $request
54- * @param \phpbb\install\installer $installer
75+ * @param helper $helper
76+ * @param config $install_config
77+ * @param factory $factory
78+ * @param navigation_provider $nav_provider
79+ * @param language $language
80+ * @param request_interface $request
81+ * @param installer $installer
5582 */
56- public function __construct (helper $ helper , \ phpbb \ install \ helper \ iohandler \ factory $ factory , \ phpbb \ template \ template $ template , \ phpbb \ request \ request_interface $ request , \ phpbb \ install \ installer $ installer )
83+ public function __construct (helper $ helper , config $ install_config , factory $ factory , navigation_provider $ nav_provider , language $ language , template $ template , request_interface $ request , installer $ installer )
5784 {
58- $ this ->controller_helper = $ helper ;
59- $ this ->iohandler_factory = $ factory ;
60- $ this ->template = $ template ;
61- $ this ->request = $ request ;
62- $ this ->installer = $ installer ;
85+ $ this ->controller_helper = $ helper ;
86+ $ this ->installer_config = $ install_config ;
87+ $ this ->iohandler_factory = $ factory ;
88+ $ this ->menu_provider = $ nav_provider ;
89+ $ this ->language = $ language ;
90+ $ this ->template = $ template ;
91+ $ this ->request = $ request ;
92+ $ this ->installer = $ installer ;
6393 }
6494
6595 /**
6696 * Controller logic
6797 *
68- * @return \Symfony\Component\HttpFoundation\ Response|StreamedResponse
98+ * @return Response|StreamedResponse
6999 */
70100 public function handle ()
71101 {
@@ -86,13 +116,38 @@ public function handle()
86116 }
87117
88118 // Set the appropriate input-output handler
89- // $this->installer->set_iohandler($this->iohandler_factory->get());
119+ $ this ->installer ->set_iohandler ($ this ->iohandler_factory ->get ());
90120
91- if ($ this ->request ->is_ajax ())
121+ // Set up navigation
122+ $ nav_data = $ this ->installer_config ->get_navigation_data ();
123+ /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
124+ $ iohandler = $ this ->iohandler_factory ->get ();
125+
126+ // Set active navigation stage
127+ if (isset ($ nav_data ['active ' ]) && is_array ($ nav_data ['active ' ]))
92128 {
93- // @todo: remove this line, and use the above
94- $ this ->installer ->set_iohandler ($ this ->iohandler_factory ->get ());
129+ $ iohandler ->set_active_stage_menu ($ nav_data ['active ' ]);
130+ $ this ->menu_provider ->set_nav_property ($ nav_data ['active ' ], array (
131+ 'selected ' => true ,
132+ 'completed ' => false ,
133+ ));
134+ }
135+
136+ // Set finished navigation stages
137+ if (isset ($ nav_data ['finished ' ]) && is_array ($ nav_data ['finished ' ]))
138+ {
139+ foreach ($ nav_data ['finished ' ] as $ finished_stage )
140+ {
141+ $ iohandler ->set_finished_stage_menu ($ finished_stage );
142+ $ this ->menu_provider ->set_nav_property ($ finished_stage , array (
143+ 'selected ' => false ,
144+ 'completed ' => true ,
145+ ));
146+ }
147+ }
95148
149+ if ($ this ->request ->is_ajax ())
150+ {
96151 $ installer = $ this ->installer ;
97152 $ response = new StreamedResponse ();
98153 $ response ->setCallback (function () use ($ installer ) {
@@ -106,9 +161,20 @@ public function handle()
106161 // Determine whether the installation was started or not
107162 if (true )
108163 {
164+ // Set active stage
165+ $ this ->menu_provider ->set_nav_property (
166+ array ('install ' , 0 , 'introduction ' ),
167+ array (
168+ 'selected ' => true ,
169+ 'completed ' => false ,
170+ )
171+ );
172+
109173 // If not, let's render the welcome page
110174 $ this ->template ->assign_vars (array (
111- 'SHOW_INSTALL_START_FORM ' => true ,
175+ 'SHOW_INSTALL_START_FORM ' => true ,
176+ 'TITLE ' => $ this ->language ->lang ('INSTALL_INTRO ' ),
177+ 'CONTENT ' => $ this ->language ->lang ('INSTALL_INTRO_BODY ' ),
112178 ));
113179 return $ this ->controller_helper ->render ('installer_install.html ' , 'INSTALL ' );
114180 }
0 commit comments