1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/11150] Add ACP gallery

PHPBB3-11150
This commit is contained in:
Tristan Darricau
2015-09-13 10:48:30 +02:00
committed by Tristan Darricau
parent c49cd29e96
commit adb8d30d98
8 changed files with 237 additions and 41 deletions

View File

@@ -28,10 +28,13 @@ class acp_extensions
var $tpl_name;
var $page_title;
private $db;
private $config;
private $template;
private $user;
private $log;
/** @var \phpbb\request\request */
private $request;
private $phpbb_dispatcher;
private $ext_manager;
@@ -39,8 +42,10 @@ class acp_extensions
function main()
{
// Start the page
global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher;
global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher;
$this->db = $db;
$this->config = $config;
$this->template = $template;
$this->user = $user;
@@ -49,7 +54,22 @@ class acp_extensions
$this->phpbb_dispatcher = $phpbb_dispatcher;
$this->ext_manager = $phpbb_extension_manager;
$this->user->add_lang(array('install', 'acp/extensions', 'migrator'));
$this->user->add_lang(['install', 'acp/extensions', 'migrator']);
switch ($mode)
{
case 'gallery':
$this->gallery_mode();
break;
default:
$this->main_mode();
break;
}
}
public function main_mode()
{
global $phpbb_extension_manager, $phpbb_root_path;
$this->page_title = 'ACP_EXTENSIONS';
@@ -381,6 +401,20 @@ class acp_extensions
$this->tpl_name = $tpl_name;
}
public function gallery_mode()
{
global $phpbb_container;
/** @var \phpbb\composer\extension_manager $manager */
$manager = $phpbb_container->get('ext.composer.manager');
$this->page_title = 'ACP_EXTENSIONS_GALLERY';
$this->tpl_name = 'acp_ext_gallery';
$this->request->enable_super_globals();
$this->template->assign_var('extensions', $manager->get_available_packages());
$this->request->disable_super_globals();
}
/**
* Lists all the enabled extensions and dumps to the template
*

View File

@@ -20,6 +20,7 @@ class acp_extensions_info
'title' => 'ACP_EXTENSION_MANAGEMENT',
'modes' => array(
'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_EXTENSION_MANAGEMENT')),
'gallery' => array('title' => 'ACP_EXTENSIONS_GALLERY', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_EXTENSION_MANAGEMENT')),
),
);
}