Allow all users to create and link people tags.

This commit is contained in:
2016-11-13 14:42:53 +01:00
parent 7f5ce1820d
commit 0a55730696
6 changed files with 94 additions and 63 deletions

View File

@@ -226,6 +226,9 @@ class Tag
if (!isset($data['id_parent']))
$data['id_parent'] = 0;
if (!isset($data['description']))
$data['description'] = 0;
if (!isset($data['count']))
$data['count'] = 0;
@@ -297,6 +300,23 @@ class Tag
['tokens' => '%' . strtolower(implode('%', $tokens)) . '%']);
}
public static function matchPeople($tokens)
{
if (!is_array($tokens))
$tokens = explode(' ', $tokens);
return Registry::get('db')->queryPair('
SELECT id_tag, tag
FROM tags
WHERE LOWER(tag) LIKE {string:tokens} AND
kind = {string:person}
ORDER BY tag ASC',
[
'tokens' => '%' . strtolower(implode('%', $tokens)) . '%',
'person' => 'Person',
]);
}
public static function exactMatch($tag)
{
if (!is_string($tag))