private function setup_navigation($stage) { $active = true; $completed = false; switch ($stage) { case 'finish': $this->navigation_provider->set_nav_property(array('convert', 0, 'finish'), array('selected' => $active, 'completed' => $completed)); $active = false; $completed = true; // no break; // no break; case 'convert': $this->navigation_provider->set_nav_property(array('convert', 0, 'convert'), array('selected' => $active, 'completed' => $completed)); $active = false; $completed = true; // no break; // no break; case 'settings': $this->navigation_provider->set_nav_property(array('convert', 0, 'settings'), array('selected' => $active, 'completed' => $completed)); $active = false; $completed = true; // no break; // no break; case 'intro': $this->navigation_provider->set_nav_property(array('convert', 0, 'intro'), array('selected' => $active, 'completed' => $completed)); break; } }
/** * Controller logic * * @return Response|StreamedResponse */ public function handle() { if ($this->install_helper->is_phpbb_installed()) { die('phpBB is already installed'); } $this->template->assign_vars(array('U_ACTION' => $this->controller_helper->route('phpbb_installer_install'))); // Set up input-output handler if ($this->request->is_ajax()) { $this->iohandler_factory->set_environment('ajax'); } else { $this->iohandler_factory->set_environment('nojs'); } // Set the appropriate input-output handler $this->installer->set_iohandler($this->iohandler_factory->get()); // Set up navigation $nav_data = $this->installer_config->get_navigation_data(); /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $this->iohandler_factory->get(); // Set active navigation stage if (isset($nav_data['active']) && is_array($nav_data['active'])) { $iohandler->set_active_stage_menu($nav_data['active']); $this->menu_provider->set_nav_property($nav_data['active'], array('selected' => true, 'completed' => false)); } // Set finished navigation stages if (isset($nav_data['finished']) && is_array($nav_data['finished'])) { foreach ($nav_data['finished'] as $finished_stage) { $iohandler->set_finished_stage_menu($finished_stage); $this->menu_provider->set_nav_property($finished_stage, array('selected' => false, 'completed' => true)); } } if ($this->request->is_ajax()) { $installer = $this->installer; $response = new StreamedResponse(); $response->setCallback(function () use($installer) { $installer->run(); }); // Try to bypass any server output buffers $response->headers->set('X-Accel-Buffering', 'no'); return $response; } else { // Determine whether the installation was started or not if (true) { $this->controller_helper->handle_language_select(); // Set active stage $this->menu_provider->set_nav_property(array('install', 0, 'introduction'), array('selected' => true, 'completed' => false)); // If not, let's render the welcome page $this->template->assign_vars(array('SHOW_INSTALL_START_FORM' => true, 'TITLE' => $this->language->lang('INSTALL_INTRO'), 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'))); return $this->controller_helper->render('installer_install.html', 'INSTALL', true); } // @todo: implement no js controller logic } }
/** * Render navigation */ protected function render_navigation() { // Get navigation items $nav_array = $this->navigation_provider->get(); $nav_array = $this->sort_navigation_level($nav_array); $active_main_menu = $this->get_active_main_menu($nav_array); // Pass navigation to template foreach ($nav_array as $key => $entry) { $this->template->assign_block_vars('t_block1', array('L_TITLE' => $this->language->lang($entry['label']), 'S_SELECTED' => $active_main_menu === $key, 'U_TITLE' => $this->route($entry['route']))); if (is_array($entry[0]) && $active_main_menu === $key) { $entry[0] = $this->sort_navigation_level($entry[0]); foreach ($entry[0] as $name => $sub_entry) { if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) { $this->template->assign_block_vars('l_block2', array('L_TITLE' => $this->language->lang($sub_entry['label']), 'S_SELECTED' => isset($sub_entry['selected']) && $sub_entry['selected'] === true, 'S_COMPLETE' => isset($sub_entry['completed']) && $sub_entry['completed'] === true, 'STAGE_NAME' => $name)); } else { $this->template->assign_block_vars('l_block1', array('L_TITLE' => $this->language->lang($sub_entry['label']), 'S_SELECTED' => isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route'), 'U_TITLE' => $this->route($sub_entry['route']))); } } } } }
/** * Controller entry point * * @return Response|StreamedResponse * * @throws http_exception When phpBB is not installed */ public function handle() { if (!$this->install_helper->is_phpbb_installed()) { throw new http_exception(403, 'INSTALL_PHPBB_NOT_INSTALLED'); } $this->template->assign_vars(array('U_ACTION' => $this->controller_helper->route('phpbb_installer_update'))); // Set up input-output handler if ($this->request->is_ajax()) { $this->iohandler_factory->set_environment('ajax'); } else { $this->iohandler_factory->set_environment('nojs'); } // Set the appropriate input-output handler $this->installer->set_iohandler($this->iohandler_factory->get()); $this->controller_helper->handle_language_select(); // Render the intro page if ($this->request->is_ajax()) { $installer = $this->installer; $response = new StreamedResponse(); $response->setCallback(function () use($installer) { $installer->run(); }); // Try to bypass any server output buffers $response->headers->set('X-Accel-Buffering', 'no'); $response->headers->set('Content-type', 'application/json'); return $response; } else { // Set active stage $this->menu_provider->set_nav_property(array('update', 0, 'introduction'), array('selected' => true, 'completed' => false)); $this->template->assign_vars(array('SHOW_INSTALL_START_FORM' => true, 'TITLE' => $this->language->lang('UPDATE_INSTALLATION'), 'CONTENT' => $this->language->lang('UPDATE_INSTALLATION_EXPLAIN'))); /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $this->iohandler_factory->get(); $this->controller_helper->handle_navigation($iohandler); return $this->controller_helper->render('installer_update.html', 'UPDATE_INSTALLATION', true); } }