Rewrite of the authentication and authorization system
This commit is contained in:
55
app/Formatter/GroupAutoCompleteFormatter.php
Normal file
55
app/Formatter/GroupAutoCompleteFormatter.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Formatter;
|
||||
|
||||
/**
|
||||
* Autocomplete formatter for groups
|
||||
*
|
||||
* @package formatter
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class GroupAutoCompleteFormatter implements FormatterInterface
|
||||
{
|
||||
/**
|
||||
* Groups found
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $groups;
|
||||
|
||||
/**
|
||||
* Format groups for the ajax autocompletion
|
||||
*
|
||||
* @access public
|
||||
* @param array $groups
|
||||
* @return GroupAutoCompleteFormatter
|
||||
*/
|
||||
public function setGroups(array $groups)
|
||||
{
|
||||
$this->groups = $groups;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format groups for the ajax autocompletion
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function format()
|
||||
{
|
||||
$result = array();
|
||||
|
||||
foreach ($this->groups as $group) {
|
||||
$result[] = array(
|
||||
'id' => $group->getInternalId(),
|
||||
'external_id' => $group->getExternalId(),
|
||||
'value' => $group->getName(),
|
||||
'label' => $group->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user