class RecordSearch extends BaseSearch (View source)

Properties

protected object $db from  BaseSearch
protected string $db_type from  BaseSearch
protected ConfigurationInterface $config from  BaseSearch
protected IPAddressValidator $ipValidator from  BaseSearch
protected UserContextService $userContext from  BaseSearch

Methods

__construct($db, $config, string $db_type, IPAddressValidator|null $ipValidator = null, UserContextService|null $userContext = null)

No description

array
buildSearchString(array $parameters)

Builds the search string for the given parameters.

string
buildRawSearchString(array $parameters)

The needle for free-text columns. Record content and comments hold whatever the user typed, so the punycoded form of the query cannot match them.

array
idnNamesMatching(string $table, string $column, string $query)

Punycode names whose decoded form contains the query.

string
idnNameCondition(string $table, string $column, string $query, string $prefix, array $params)

Extend a name predicate so partial IDN queries match. Returns the SQL to append, binding one placeholder per matching name into $params.

string
handleSqlMode()

No description

void
restoreSqlMode(string $originalSqlMode)

Restores the original SQL mode for the MySQL database connection if needed.

array
searchRecords(array $parameters, string $permission_view, string $sort_records_by, string $record_sort_direction, bool $iface_search_group_records, int $iface_rowamount, bool $iface_record_comments, int $page = 1)

Search for records based on specified parameters.

array
fetchRecords(array $parameters, mixed $search_string, bool $reverse, mixed $reverse_search_string, string $permission_view, bool $iface_search_group_records, string $sort_records_by, string $record_sort_direction, int $iface_rowamount, bool $iface_record_comments, int $page)

Fetch records based on the given search criteria.

int
getTotalRecords(array $parameters, string $permission_view, bool $iface_search_group_records)

Get the total number of records based on the specified parameters.

int
getFoundRecords(array $parameters, mixed $search_string, bool $reverse, mixed $reverse_search_string, string $permission_view, bool $iface_search_group_records)

Get the total number of found records based on the given search criteria.

Details

__construct($db, $config, string $db_type, IPAddressValidator|null $ipValidator = null, UserContextService|null $userContext = null)

No description

Parameters

$db
$config
string $db_type
IPAddressValidator|null $ipValidator
UserContextService|null $userContext

protected array buildSearchString(array $parameters)

Builds the search string for the given parameters.

Parameters

array $parameters

An array containing search parameters, including 'reverse' for reverse DNS lookup, 'query' for the search term, and 'wildcard' for enabling/disabling wildcard search.

Return Value

array

An array containing the reverse search string, the updated parameters, and the generated search string.

protected string buildRawSearchString(array $parameters)

The needle for free-text columns. Record content and comments hold whatever the user typed, so the punycoded form of the query cannot match them.

Parameters

array $parameters

Return Value

string

protected array idnNamesMatching(string $table, string $column, string $query)

Punycode names whose decoded form contains the query.

The punycode of a substring is not a substring of the punycode, so a partial query like "munch" can never match "xn--mnchen-3ya" through LIKE. Decoding the IDN names and comparing in PHP is bounded to the rows that are actually punycode.

Parameters

string $table
string $column
string $query

Return Value

array

protected string idnNameCondition(string $table, string $column, string $query, string $prefix, array $params)

Extend a name predicate so partial IDN queries match. Returns the SQL to append, binding one placeholder per matching name into $params.

Parameters

string $table
string $column
string $query
string $prefix
array $params

Return Value

string

protected string handleSqlMode()

No description

Return Value

string

protected void restoreSqlMode(string $originalSqlMode)

Restores the original SQL mode for the MySQL database connection if needed.

Parameters

string $originalSqlMode

The original SQL mode to be restored.

Return Value

void

array searchRecords(array $parameters, string $permission_view, string $sort_records_by, string $record_sort_direction, bool $iface_search_group_records, int $iface_rowamount, bool $iface_record_comments, int $page = 1)

Search for records based on specified parameters.

Parameters

array $parameters

An array of search parameters.

string $permission_view

The permission view for the search.

string $sort_records_by

The column to sort the records by.

string $record_sort_direction
bool $iface_search_group_records

Whether to group records or not.

int $iface_rowamount

The number of rows to display per page.

bool $iface_record_comments

Whether to display record comments or not.

int $page

The current page number (default is 1).

Return Value

array

An array of found records.

array fetchRecords(array $parameters, mixed $search_string, bool $reverse, mixed $reverse_search_string, string $permission_view, bool $iface_search_group_records, string $sort_records_by, string $record_sort_direction, int $iface_rowamount, bool $iface_record_comments, int $page)

Fetch records based on the given search criteria.

Parameters

array $parameters

Search parameters

mixed $search_string

Search string for matching records

bool $reverse

Whether to perform a reverse search

mixed $reverse_search_string

Reverse search string for matching records

string $permission_view

Permission view for the search

bool $iface_search_group_records

Whether to search group records

string $sort_records_by

Column to sort records by

string $record_sort_direction

Sort direction

int $iface_rowamount

Rows per page

bool $iface_record_comments

Whether to display record comments

int $page

Current page number

Return Value

array

Found records

int getTotalRecords(array $parameters, string $permission_view, bool $iface_search_group_records)

Get the total number of records based on the specified parameters.

Parameters

array $parameters

An array of search parameters.

string $permission_view

The permission view for the search.

bool $iface_search_group_records

Whether to search group records or not.

Return Value

int

The total number of found records.

int getFoundRecords(array $parameters, mixed $search_string, bool $reverse, mixed $reverse_search_string, string $permission_view, bool $iface_search_group_records)

Get the total number of found records based on the given search criteria.

Parameters

array $parameters

An array of search parameters.

mixed $search_string

The search string to use for matching records.

bool $reverse

Whether to perform a reverse search or not.

mixed $reverse_search_string

The reverse search string to use for matching records.

string $permission_view

The permission view for the search.

bool $iface_search_group_records

Whether to search group records or not.

Return Value

int

The total number of found records.