aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/install/helper/navigation
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/install/helper/navigation')
-rw-r--r--phpBB/phpbb/install/helper/navigation/convertor_navigation.php78
-rw-r--r--phpBB/phpbb/install/helper/navigation/install_navigation.php75
-rw-r--r--phpBB/phpbb/install/helper/navigation/main_navigation.php48
-rw-r--r--phpBB/phpbb/install/helper/navigation/navigation_interface.php43
-rw-r--r--phpBB/phpbb/install/helper/navigation/navigation_provider.php121
-rw-r--r--phpBB/phpbb/install/helper/navigation/update_navigation.php80
6 files changed, 445 insertions, 0 deletions
diff --git a/phpBB/phpbb/install/helper/navigation/convertor_navigation.php b/phpBB/phpbb/install/helper/navigation/convertor_navigation.php
new file mode 100644
index 0000000000..54cab83b1d
--- /dev/null
+++ b/phpBB/phpbb/install/helper/navigation/convertor_navigation.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\install\helper\navigation;
+
+use phpbb\install\helper\install_helper;
+
+class convertor_navigation implements navigation_interface
+{
+ /**
+ * @var install_helper
+ */
+ private $install_helper;
+
+ /**
+ * Constructor
+ *
+ * @param install_helper $install_helper
+ */
+ public function __construct(install_helper $install_helper)
+ {
+ $this->install_helper = $install_helper;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get()
+ {
+ if (!$this->install_helper->is_phpbb_installed())
+ {
+ return array();
+ }
+
+ return array(
+ 'convert' => array(
+ 'label' => 'CONVERT',
+ 'route' => 'phpbb_convert_intro',
+ 'order' => 3,
+ array(
+ 'intro' => array(
+ 'label' => 'SUB_INTRO',
+ 'stage' => true,
+ 'order' => 0,
+ ),
+ 'settings' => array(
+ 'label' => 'STAGE_SETTINGS',
+ 'stage' => true,
+ 'route' => 'phpbb_convert_settings',
+ 'order' => 1,
+ ),
+ 'convert' => array(
+ 'label' => 'STAGE_IN_PROGRESS',
+ 'stage' => true,
+ 'route' => 'phpbb_convert_convert',
+ 'order' => 2,
+ ),
+ 'finish' => array(
+ 'label' => 'CONVERT_COMPLETE',
+ 'stage' => true,
+ 'route' => 'phpbb_convert_finish',
+ 'order' => 3,
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/install/helper/navigation/install_navigation.php b/phpBB/phpbb/install/helper/navigation/install_navigation.php
new file mode 100644
index 0000000000..f690f8de76
--- /dev/null
+++ b/phpBB/phpbb/install/helper/navigation/install_navigation.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\install\helper\navigation;
+
+use phpbb\install\helper\install_helper;
+
+class install_navigation implements navigation_interface
+{
+ /**
+ * @var install_helper
+ */
+ private $install_helper;
+
+ /**
+ * Constructor
+ *
+ * @param install_helper $install_helper
+ */
+ public function __construct(install_helper $install_helper)
+ {
+ $this->install_helper = $install_helper;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get()
+ {
+ if ($this->install_helper->is_phpbb_installed())
+ {
+ return array();
+ }
+
+ return array(
+ 'install' => array(
+ 'label' => 'INSTALL',
+ 'route' => 'phpbb_installer_install',
+ 'order' => 1,
+ array(
+ 'introduction' => array(
+ 'label' => 'INTRODUCTION_TITLE',
+ 'stage' => true,
+ 'order' => 0,
+ ),
+ 'requirements' => array(
+ 'label' => 'STAGE_REQUIREMENTS',
+ 'stage' => true,
+ 'order' => 1,
+ ),
+ 'obtain_data' => array(
+ 'label' => 'STAGE_OBTAIN_DATA',
+ 'stage' => true,
+ 'order' => 2,
+ ),
+ 'install' => array(
+ 'label' => 'STAGE_INSTALL',
+ 'stage' => true,
+ 'order' => 3,
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/install/helper/navigation/main_navigation.php b/phpBB/phpbb/install/helper/navigation/main_navigation.php
new file mode 100644
index 0000000000..214bb04963
--- /dev/null
+++ b/phpBB/phpbb/install/helper/navigation/main_navigation.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\install\helper\navigation;
+
+class main_navigation implements navigation_interface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function get()
+ {
+ return array(
+ 'overview' => array(
+ 'label' => 'MENU_OVERVIEW',
+ 'route' => 'phpbb_installer_index',
+ 'order' => 0,
+ array(
+ 'introduction' => array(
+ 'label' => 'MENU_INTRO',
+ 'route' => 'phpbb_installer_index',
+ 'order' => 0,
+ ),
+ 'support' => array(
+ 'label' => 'MENU_SUPPORT',
+ 'route' => 'phpbb_installer_support',
+ 'order' => 1,
+ ),
+ 'license' => array(
+ 'label' => 'MENU_LICENSE',
+ 'route' => 'phpbb_installer_license',
+ 'order' => 2,
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/install/helper/navigation/navigation_interface.php b/phpBB/phpbb/install/helper/navigation/navigation_interface.php
new file mode 100644
index 0000000000..eebdbe923f
--- /dev/null
+++ b/phpBB/phpbb/install/helper/navigation/navigation_interface.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\install\helper\navigation;
+
+/**
+ * Interface for installer's navigation defining services
+ */
+interface navigation_interface
+{
+ /**
+ * Returns an array with the navigation items
+ *
+ * The returned array should have the following format:
+ * <code>
+ * array(
+ * 'parent_nav_name' => array(
+ * 'nav_name' => array(
+ * 'label' => 'MY_MENU',
+ * 'route' => 'phpbb_route_name',
+ * )
+ * )
+ * )
+ * </code>
+ *
+ * Navigation item setting options:
+ * - label: The language variable name
+ * - route: Name of the route which it is belongs to
+ *
+ * @return array
+ */
+ public function get();
+}
diff --git a/phpBB/phpbb/install/helper/navigation/navigation_provider.php b/phpBB/phpbb/install/helper/navigation/navigation_provider.php
new file mode 100644
index 0000000000..d52aec8999
--- /dev/null
+++ b/phpBB/phpbb/install/helper/navigation/navigation_provider.php
@@ -0,0 +1,121 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\install\helper\navigation;
+
+use phpbb\di\service_collection;
+
+/**
+ * Installers navigation provider
+ */
+class navigation_provider
+{
+ /**
+ * @var array
+ */
+ private $menu_collection;
+
+ /**
+ * Constructor
+ *
+ * @param service_collection $plugins
+ */
+ public function __construct(service_collection $plugins)
+ {
+ $this->menu_collection = array();
+
+ foreach ($plugins as $plugin => $plugin_instance)
+ {
+ $this->register($plugin_instance);
+ }
+ }
+
+ /**
+ * Returns navigation array
+ *
+ * @return array
+ */
+ public function get()
+ {
+ return $this->menu_collection;
+ }
+
+ /**
+ * Registers a navigation provider's navigation items
+ *
+ * @param navigation_interface $navigation
+ */
+ public function register(navigation_interface $navigation)
+ {
+ $nav_arry = $navigation->get();
+ $this->menu_collection = $this->merge($nav_arry, $this->menu_collection);
+ }
+
+ /**
+ * Set a property in the navigation array
+ *
+ * @param array $nav_element Array to the navigation elem
+ * @param array $property_array Array with the properties to set
+ */
+ public function set_nav_property($nav_element, $property_array)
+ {
+ $array_pointer = array();
+ $array_root_pointer = &$array_pointer;
+ foreach ($nav_element as $array_path)
+ {
+ $array_pointer[$array_path] = array();
+ $array_pointer = &$array_pointer[$array_path];
+ }
+
+ $array_pointer = $property_array;
+
+ $this->menu_collection = $this->merge($array_root_pointer, $this->menu_collection);
+ }
+
+ /**
+ * Recursive array merge
+ *
+ * This function is necessary to be able to replace the options of
+ * already set navigation items.
+ *
+ * @param array $array_to_merge
+ * @param array $array_to_merge_into
+ *
+ * @return array Merged array
+ */
+ private function merge($array_to_merge, $array_to_merge_into)
+ {
+ $merged_array = $array_to_merge_into;
+
+ foreach ($array_to_merge as $key => $value)
+ {
+ if (isset($array_to_merge_into[$key]))
+ {
+ if (is_array($array_to_merge_into[$key]) && is_array($value))
+ {
+ $merged_array[$key] = $this->merge($value, $array_to_merge_into[$key]);
+ }
+ else
+ {
+ $merged_array[$key] = $value;
+ }
+ }
+ else
+ {
+ $merged_array[$key] = $value;
+ }
+ }
+
+ return $merged_array;
+ }
+}
diff --git a/phpBB/phpbb/install/helper/navigation/update_navigation.php b/phpBB/phpbb/install/helper/navigation/update_navigation.php
new file mode 100644
index 0000000000..3d239c3451
--- /dev/null
+++ b/phpBB/phpbb/install/helper/navigation/update_navigation.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\install\helper\navigation;
+
+use phpbb\install\helper\install_helper;
+
+class update_navigation implements navigation_interface
+{
+ /**
+ * @var install_helper
+ */
+ private $install_helper;
+
+ /**
+ * Constructor
+ *
+ * @param install_helper $install_helper
+ */
+ public function __construct(install_helper $install_helper)
+ {
+ $this->install_helper = $install_helper;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get()
+ {
+ if (!$this->install_helper->is_phpbb_installed())
+ {
+ return array();
+ }
+
+ return array(
+ 'update' => array(
+ 'label' => 'UPDATE',
+ 'route' => 'phpbb_installer_update',
+ 'order' => 1,
+ array(
+ 'introduction' => array(
+ 'label' => 'INTRODUCTION_TITLE',
+ 'stage' => true,
+ 'order' => 0,
+ ),
+ 'requirements' => array(
+ 'label' => 'STAGE_REQUIREMENTS',
+ 'stage' => true,
+ 'order' => 1,
+ ),
+ 'obtain_data' => array(
+ 'label' => 'STAGE_OBTAIN_DATA',
+ 'stage' => true,
+ 'order' => 2,
+ ),
+ 'update_files' => array(
+ 'label' => 'STAGE_UPDATE_FILES',
+ 'stage' => true,
+ 'order' => 3,
+ ),
+ 'update_database' => array(
+ 'label' => 'STAGE_UPDATE_DATABASE',
+ 'stage' => true,
+ 'order' => 4,
+ ),
+ ),
+ ),
+ );
+ }
+}