blob: 9ea768813e7e3640d70eb4c2d0a8d7757cdf61b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
namespace Kanboard\Formatter;
use Kanboard\Core\Filter\FormatterInterface;
/**
* Class UserMentionFormatter
*
* @package Kanboard\Formatter
* @author Frederic Guillot
*/
class UserMentionFormatter extends BaseFormatter implements FormatterInterface
{
protected $users = array();
/**
* Set users
*
* @param array $users
* @return $this
*/
public function withUsers(array $users) {
$this->users = $users;
return $this;
}
/**
* Apply formatter
*
* @access public
* @return array
*/
public function format()
{
$result = array();
foreach ($this->users as $user) {
$html = $this->helper->avatar->small(
$user['id'],
$user['username'],
$user['name'],
$user['email'],
$user['avatar_path'],
'avatar-inline'
);
$html .= ' '.$this->helper->text->e($user['username']);
if (! empty($user['name'])) {
$html .= ' <small>'.$this->helper->text->e($user['name']).'</small>';
}
$result[] = array(
'value' => $user['username'],
'html' => $html,
);
}
return $result;
}
}
|