Airship\Cabin\Bridge\Blueprint\UserAccounts::getDirectory PHP Method

getDirectory() public method

Get the user directory.
public getDirectory ( integer $offset, integer $limit = 20 ) : array
$offset integer
$limit integer
return array
    public function getDirectory(int $offset = 0, int $limit = 20) : array
    {
        $rows = $this->db->run('SELECT
                 uniqueid,
                 display_name
             FROM
                 airship_users
             WHERE
                 publicprofile
             ORDER BY display_name ASC, uniqueid ASC
             OFFSET ' . $offset . ' LIMIT ' . $limit);
        if (empty($rows)) {
            return [];
        }
        return $rows;
    }

Usage Example

Esempio n. 1
0
 /**
  * A directory of public users
  *
  * @param string $page
  * @route users{_page}
  */
 public function publicDirectory(string $page = '')
 {
     list($offset, $limit) = $this->getOffsetAndLimit($page);
     $directory = $this->acct->getDirectory($offset, $limit);
     $this->lens('user_directory', ['directory' => $directory, 'pagination' => ['base' => $this->airship_cabin_prefix . '/users', 'suffix' => '/', 'count' => $this->acct->countPublicUsers(), 'page' => (int) \ceil($offset / ($limit ?? 1)) + 1, 'per_page' => $limit]]);
 }