mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/13713] Implement ranks
PHPBB3-13713
This commit is contained in:
parent
a176be4c1d
commit
f775c1e79d
8 changed files with 55 additions and 12 deletions
|
@ -390,8 +390,9 @@ function getCaretPosition(txtarea) {
|
||||||
at: "@",
|
at: "@",
|
||||||
displayTpl: function(data) {
|
displayTpl: function(data) {
|
||||||
var avatar = (data.avatar.src) ? "<img src='" + data.avatar.src + "'>" :
|
var avatar = (data.avatar.src) ? "<img src='" + data.avatar.src + "'>" :
|
||||||
"<span class='mention-avatar'><i class='fa fa-" + data.avatar.type + "'></i></span>";
|
"<span class='mention-avatar'><i class='fa fa-" + data.avatar.type + "'></i></span>",
|
||||||
return "<li>" + avatar + "<span>" + data.name + "</span></li>";
|
rank = (data.rank) ? "<span class='mention-rank'>" + data.rank + "</span>" : '';
|
||||||
|
return "<li>" + avatar + "<span>" + data.name + "</span>" + rank + "</li>";
|
||||||
},
|
},
|
||||||
insertTpl: "[mention ${param}=${id}]${name}[/mention]",
|
insertTpl: "[mention ${param}=${id}]${name}[/mention]",
|
||||||
callbacks: {
|
callbacks: {
|
||||||
|
|
|
@ -22,6 +22,8 @@ services:
|
||||||
- '@dbal.conn'
|
- '@dbal.conn'
|
||||||
- '@user_loader'
|
- '@user_loader'
|
||||||
- '@user'
|
- '@user'
|
||||||
|
- '%core.root_path%'
|
||||||
|
- '%core.php_ext%'
|
||||||
tags:
|
tags:
|
||||||
- { name: mention.source }
|
- { name: mention.source }
|
||||||
|
|
||||||
|
@ -30,6 +32,8 @@ services:
|
||||||
arguments:
|
arguments:
|
||||||
- '@dbal.conn'
|
- '@dbal.conn'
|
||||||
- '@user_loader'
|
- '@user_loader'
|
||||||
|
- '%core.root_path%'
|
||||||
|
- '%core.php_ext%'
|
||||||
tags:
|
tags:
|
||||||
- { name: mention.source }
|
- { name: mention.source }
|
||||||
|
|
||||||
|
@ -39,5 +43,7 @@ services:
|
||||||
- '@dbal.conn'
|
- '@dbal.conn'
|
||||||
- '@group_helper'
|
- '@group_helper'
|
||||||
- '@user'
|
- '@user'
|
||||||
|
- '%core.root_path%'
|
||||||
|
- '%core.php_ext%'
|
||||||
tags:
|
tags:
|
||||||
- { name: mention.source }
|
- { name: mention.source }
|
||||||
|
|
|
@ -21,11 +21,11 @@ class friend extends user
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, \phpbb\user $user)
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, \phpbb\user $user, $phpbb_root_path, $phpEx)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
parent::__construct($db, $user_loader);
|
parent::__construct($db, $user_loader, $phpbb_root_path, $phpEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,13 +21,26 @@ abstract class group implements source_interface
|
||||||
/** @var \phpbb\group\helper */
|
/** @var \phpbb\group\helper */
|
||||||
protected $helper;
|
protected $helper;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $php_ext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper)
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, $phpbb_root_path, $phpEx)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->helper = $helper;
|
$this->helper = $helper;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->php_ext = $phpEx;
|
||||||
|
|
||||||
|
if (!function_exists('phpbb_get_user_rank'))
|
||||||
|
{
|
||||||
|
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,6 +106,7 @@ abstract class group implements source_interface
|
||||||
$names = [];
|
$names = [];
|
||||||
foreach ($group_ids as $group_id)
|
foreach ($group_ids as $group_id)
|
||||||
{
|
{
|
||||||
|
$group_rank = phpbb_get_user_rank($groups[$group_id], false);
|
||||||
$names['g' . $group_id] = [
|
$names['g' . $group_id] = [
|
||||||
'name' => $groups[$group_id]['group_name'],
|
'name' => $groups[$group_id]['group_name'],
|
||||||
'param' => 'group_id',
|
'param' => 'group_id',
|
||||||
|
@ -101,6 +115,7 @@ abstract class group implements source_interface
|
||||||
'type' => 'group',
|
'type' => 'group',
|
||||||
'src' => phpbb_get_group_avatar($groups[$group_id]),
|
'src' => phpbb_get_group_avatar($groups[$group_id]),
|
||||||
],
|
],
|
||||||
|
'rank' => $group_rank['title'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,26 @@ abstract class user implements source_interface
|
||||||
/** @var \phpbb\user_loader */
|
/** @var \phpbb\user_loader */
|
||||||
protected $user_loader;
|
protected $user_loader;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $php_ext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader)
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, $phpbb_root_path, $phpEx)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->user_loader = $user_loader;
|
$this->user_loader = $user_loader;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->php_ext = $phpEx;
|
||||||
|
|
||||||
|
if (!function_exists('phpbb_get_user_rank'))
|
||||||
|
{
|
||||||
|
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +63,7 @@ abstract class user implements source_interface
|
||||||
$names = [];
|
$names = [];
|
||||||
while ($row = $this->db->sql_fetchrow($res))
|
while ($row = $this->db->sql_fetchrow($res))
|
||||||
{
|
{
|
||||||
|
$user_rank = $this->user_loader->get_rank($row['user_id'], true);
|
||||||
$names['u' . $row['user_id']] = [
|
$names['u' . $row['user_id']] = [
|
||||||
'name' => $row['username'],
|
'name' => $row['username'],
|
||||||
'param' => 'user_id',
|
'param' => 'user_id',
|
||||||
|
@ -58,6 +72,7 @@ abstract class user implements source_interface
|
||||||
'type' => 'user',
|
'type' => 'user',
|
||||||
'src' => $this->user_loader->get_avatar($row['user_id'], true),
|
'src' => $this->user_loader->get_avatar($row['user_id'], true),
|
||||||
],
|
],
|
||||||
|
'rank' => (isset($user_rank['rank_title'])) ? $user_rank['rank_title'] : '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@ class usergroup extends group
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, \phpbb\user $user)
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, \phpbb\user $user, $phpbb_root_path, $phpEx)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
parent::__construct($db, $helper);
|
parent::__construct($db, $helper, $phpbb_root_path, $phpEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -937,7 +937,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.mention-avatar {
|
.mention-avatar {
|
||||||
right: 8px;
|
right: 7px;
|
||||||
left: auto;
|
left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ fieldset.submit-buttons input {
|
||||||
/* Mention dropdown */
|
/* Mention dropdown */
|
||||||
.atwho-container .atwho-view {
|
.atwho-container .atwho-view {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
min-width: 300px;
|
min-width: 260px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.atwho-container .atwho-view ul li {
|
.atwho-container .atwho-view ul li {
|
||||||
|
@ -304,11 +304,17 @@ fieldset.submit-buttons input {
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 8px;
|
left: 7px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin-top: -15px;
|
margin-top: -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mention-rank {
|
||||||
|
font-size: 10px;
|
||||||
|
display: block;
|
||||||
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Input field styles
|
/* Input field styles
|
||||||
|
|
Loading…
Add table
Reference in a new issue