*/ class Directory extends BaseController { /** * @var \Atlas\Pdo\Connection */ private $atlas; /** * @var \Friendica\Directory\Models\Server */ private $serverModel; /** * @var \Friendica\Directory\Models\Profile */ private $profileModel; /** * @var \Friendica\Directory\Views\Widget\AccountTypeTabs */ private $accountTypeTabs; /** * @var \Friendica\Directory\Views\PhpRenderer */ private $renderer; /** * @var \Gettext\TranslatorInterface */ private $l10n; public function __construct( \Atlas\Pdo\Connection $atlas, \Friendica\Directory\Models\Server $serverModel, \Friendica\Directory\Models\Profile $profileModel, \Friendica\Directory\Views\Widget\AccountTypeTabs $accountTypeTabs, \Friendica\Directory\Views\PhpRenderer $renderer, \Gettext\TranslatorInterface $l10n ) { $this->atlas = $atlas; $this->serverModel = $serverModel; $this->profileModel = $profileModel; $this->accountTypeTabs = $accountTypeTabs; $this->renderer = $renderer; $this->l10n = $l10n; } public function render(Request $request, Response $response, array $args): array { $popularTags = new PopularTags($this->atlas, $this->renderer); $popularCountries = new PopularCountries($this->atlas, $this->renderer); $popularLanguages = new PopularProfileLanguages($this->atlas, $this->renderer); $pager = new Pager($this->l10n, $request, 20); $sql_where = ''; $values = []; if (!empty($args['account_type'])) { $sql_where = '`account_type` = :account_type'; $values = ['account_type' => $args['account_type']]; } $profiles = $this->profileModel->getListForDisplay( $this->serverModel->getSubscribeUrlByProfile($request->getQueryParam('zrl', '')), $pager->getItemsPerPage(), $pager->getStart(), $sql_where, $values, ); $count = $this->profileModel->getCountForDisplay($sql_where, $values); $vars = [ 'title' => $this->l10n->gettext('People'), 'profiles' => $profiles, 'pager_full' => $pager->renderFull($count), 'pager_minimal' => $pager->renderMinimal($count), 'accountTypeTabs' => $this->accountTypeTabs->render('directory', $args['account_type'] ?? ''), 'popularTags' => $popularTags->render(), 'popularCountries' => $popularCountries->render(), 'popularLanguages' => $popularLanguages->render(), ]; $content = $this->renderer->fetch('directory.phtml', $vars); return ['content' => $content]; } }