]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact/Contacts.php
Add Dice logging for Module creation
[friendica.git] / src / Module / Contact / Contacts.php
index 355619c712d2daf4b874229f05552becb1d82d26..4d74935387e7633dd4041172344f3da13bbd8c60 100644 (file)
@@ -4,16 +4,17 @@ namespace Friendica\Module\Contact;
 
 use Friendica\BaseModule;
 use Friendica\Content\Pager;
+use Friendica\Content\Widget;
 use Friendica\Core\Renderer;
-use Friendica\Core\Session;
 use Friendica\DI;
 use Friendica\Model;
+use Friendica\Model\User;
 use Friendica\Module;
 use Friendica\Network\HTTPException;
 
 class Contacts extends BaseModule
 {
-       public static function content(array $parameters = [])
+       protected function content(array $request = []): string
        {
                $app = DI::app();
 
@@ -21,8 +22,10 @@ class Contacts extends BaseModule
                        throw new HTTPException\ForbiddenException();
                }
 
-               $cid = $parameters['id'];
-               $type = $parameters['type'] ?? 'all';
+               $cid = $this->parameters['id'];
+               $type = $this->parameters['type'] ?? 'all';
+               $accounttype = $_GET['accounttype'] ?? '';
+               $accounttypeid = User::getAccountTypeByString($accounttype);
 
                if (!$cid) {
                        throw new HTTPException\BadRequestException(DI::l10n()->t('Invalid contact.'));
@@ -35,14 +38,19 @@ class Contacts extends BaseModule
 
                $localContactId = Model\Contact::getPublicIdByUserId(local_user());
 
-               Model\Profile::load($app, '', $contact);
+               DI::page()['aside'] = Widget\VCard::getHTML($contact);
 
                $condition = [
                        'blocked' => false,
                        'self' => false,
                        'hidden' => false,
+                       'failed' => false,
                ];
 
+               if (isset($accounttypeid)) {
+                       $condition['contact-type'] = $accounttypeid;
+               }
+
                $noresult_label = DI::l10n()->t('No known contacts.');
 
                switch ($type) {
@@ -56,10 +64,6 @@ class Contacts extends BaseModule
                                $total = Model\Contact\Relation::countMutuals($cid, $condition);
                                break;
                        case 'common':
-                               $condition = [
-                                       'NOT `self` AND NOT `blocked` AND NOT `hidden` AND `id` != ?',
-                                       $localContactId,
-                               ];
                                $total = Model\Contact\Relation::countCommon($localContactId, $cid, $condition);
                                $noresult_label = DI::l10n()->t('No common contacts.');
                                break;
@@ -118,6 +122,8 @@ class Contacts extends BaseModule
                        '$paginate' => $pager->renderFull($total),
                ]);
 
+               DI::page()['aside'] .= Widget::accounttypes($_SERVER['REQUEST_URI'], $accounttype);
+
                return $o;
        }
 }