mirror of
https://github.com/friendica/friendica
synced 2025-05-11 20:24:16 +02:00
Filter for account type for contacts
This commit is contained in:
parent
ae6b380362
commit
4b9cbac23e
7 changed files with 78 additions and 53 deletions
|
@ -469,7 +469,7 @@ class Relation
|
|||
);
|
||||
|
||||
return DI::dba()->selectToArray('contact', [], $condition,
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -485,8 +485,8 @@ class Relation
|
|||
public static function countAll(int $cid, array $condition = [])
|
||||
{
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
['`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
||||
OR `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)',
|
||||
['(`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
||||
OR `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`))',
|
||||
$cid, $cid]
|
||||
);
|
||||
|
||||
|
@ -507,13 +507,13 @@ class Relation
|
|||
public static function listAll(int $cid, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
|
||||
{
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
['`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
||||
OR `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)',
|
||||
['(`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
||||
OR `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`))',
|
||||
$cid, $cid]
|
||||
);
|
||||
|
||||
return DI::dba()->selectToArray('contact', [], $condition,
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -560,7 +560,7 @@ class Relation
|
|||
);
|
||||
|
||||
return DI::dba()->selectToArray('contact', [], $condition,
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -605,7 +605,7 @@ class Relation
|
|||
);
|
||||
|
||||
return DI::dba()->selectToArray('contact', [], $condition,
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ class Relation
|
|||
);
|
||||
|
||||
return DI::dba()->selectToArray('contact', [], $condition,
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
|
||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,29 @@ class User
|
|||
|
||||
private static $owner;
|
||||
|
||||
/**
|
||||
* Returns the numeric account type by their string
|
||||
*
|
||||
* @param string $accounttype as string constant
|
||||
* @return void
|
||||
*/
|
||||
public static function getAccountTypeByString(string $accounttype)
|
||||
{
|
||||
switch ($accounttype) {
|
||||
case 'person':
|
||||
return User::ACCOUNT_TYPE_PERSON;
|
||||
case 'organisation':
|
||||
return User::ACCOUNT_TYPE_ORGANISATION;
|
||||
case 'news':
|
||||
return User::ACCOUNT_TYPE_NEWS;
|
||||
case 'community':
|
||||
return User::ACCOUNT_TYPE_COMMUNITY;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the system account
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue