TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
LiveSearch Class Reference

Public Member Functions

 __construct ()
 
 findPage ($searchQuery)
 
 find ($searchQuery)
 
 getRecordTitlePrep ($title, $titleLength=0)
 
 getQueryString ($tableName= '')
 
 setLimitCount ($limitCount)
 
 setStartCount ($startCount)
 
 setQueryString ($queryString)
 

Public Attributes

const PAGE_JUMP_TABLE = 'pages'
 
const RECURSIVE_PAGE_LEVEL = 99
 
const GROUP_TITLE_MAX_LENGTH = 15
 
const RECORD_TITLE_MAX_LENGTH = 28
 

Protected Member Functions

 findPageById ($id)
 
 findByGlobalTableList ($pageIdList)
 
 findByTable ($tableName, $pageIdList, $limit)
 
 getRecordArray ($tableName, $where, $orderBy, $limit)
 
 getEditLink ($tableName, $row)
 
 getTitleOfCurrentRecordType ($tableName)
 
 makeQuerySearchByTable ($tableName, array $fieldsToSearchWithin)
 
 makeOrderByTable ($tableName)
 
 extractSearchableFieldsFromTable ($tableName)
 
 getAvailablePageIds ($id, $depth)
 

Protected Attributes

 $userPermissions = ''
 
 $queryParser = null
 

Private Attributes

 $queryString = ''
 
 $startCount = 0
 
 $limitCount = 5
 

Detailed Description

Class for handling backend live search.

Definition at line 27 of file LiveSearch.php.

Constructor & Destructor Documentation

__construct ( )

Initialize access settings

Definition at line 77 of file LiveSearch.php.

References $GLOBALS, and GeneralUtility\makeInstance().

Member Function Documentation

extractSearchableFieldsFromTable (   $tableName)
protected

Get all fields from given table where we can search for.

Parameters
string$tableNameName of the table for which to get the searchable fields
Returns
array

Definition at line 388 of file LiveSearch.php.

References $GLOBALS, and GeneralUtility\trimExplode().

Referenced by LiveSearch\findByTable().

find (   $searchQuery)

Find records from database based on the given $searchQuery.

Parameters
string$searchQuery
Returns
array Result list of database search.

Definition at line 106 of file LiveSearch.php.

References $GLOBALS, LiveSearch\$limitCount, LiveSearch\findByGlobalTableList(), LiveSearch\findByTable(), LiveSearch\getAvailablePageIds(), and LiveSearch\setQueryString().

findByGlobalTableList (   $pageIdList)
protected

Find records from all registered TCA table & column values.

Parameters
string$pageIdListComma separated list of page IDs
Returns
array Records found in the database matching the searchQuery

Definition at line 152 of file LiveSearch.php.

References $GLOBALS, LiveSearch\$limitCount, and LiveSearch\findByTable().

Referenced by LiveSearch\find().

findByTable (   $tableName,
  $pageIdList,
  $limit 
)
protected

Find records by given table name.

Parameters
string$tableNameDatabase table name
string$pageIdListComma separated list of page IDs
string$limitMySql Limit notation
Returns
array Records found in the database matching the searchQuery
See Also
getRecordArray()
makeOrderByTable()
makeQuerySearchByTable()
extractSearchableFieldsFromTable()

Definition at line 186 of file LiveSearch.php.

References LiveSearch\extractSearchableFieldsFromTable(), LiveSearch\getRecordArray(), LiveSearch\makeOrderByTable(), and LiveSearch\makeQuerySearchByTable().

Referenced by LiveSearch\find(), and LiveSearch\findByGlobalTableList().

findPage (   $searchQuery)

Find records from database based on the given $searchQuery.

Parameters
string$searchQuery
Returns
string Edit link to an page record if exists. Otherwise an empty string will returned

Definition at line 89 of file LiveSearch.php.

References LiveSearch\findPageById(), and LiveSearch\getEditLink().

findPageById (   $id)
protected

Retrieve the page record from given $id.

Parameters
int$id
Returns
array

Definition at line 136 of file LiveSearch.php.

References BackendUtility\getRecord().

Referenced by LiveSearch\findPage().

getAvailablePageIds (   $id,
  $depth 
)
protected

Creates an instance of which will select a page tree to $depth and return the object. In that object we will find the ids of the tree.

Parameters
int$idPage id.
int$depthDepth to go down.
Returns
string Comma separated list of uids

Definition at line 460 of file LiveSearch.php.

References GeneralUtility\makeInstance().

Referenced by LiveSearch\find().

getEditLink (   $tableName,
  $row 
)
protected

Build a backend edit link based on given record.

Parameters
string$tableNameRecord table name
array$rowCurrent record row from database.
Returns
string Link to open an edit window for record.
See Also
::readPageAccess()

Definition at line 247 of file LiveSearch.php.

References $GLOBALS, Permission\CONTENT_EDIT, BackendUtility\getRecord(), Permission\PAGE_EDIT, and BackendUtility\readPageAccess().

Referenced by LiveSearch\findPage(), and LiveSearch\getRecordArray().

getQueryString (   $tableName = '')

Safely retrieve the queryString.

Parameters
string$tableName
Returns
string

Definition at line 410 of file LiveSearch.php.

References $GLOBALS.

getRecordArray (   $tableName,
  $where,
  $orderBy,
  $limit 
)
protected

Process the Database operation to get the search result.

Parameters
string$tableNameDatabase table name
string$where
string$orderBy
string$limitMySql Limit notation
Returns
array
See Also
getTitleFromCurrentRow()
getEditLink()

Definition at line 209 of file LiveSearch.php.

References $GLOBALS, LiveSearch\getEditLink(), BackendUtility\getRecordTitle(), LiveSearch\getTitleOfCurrentRecordType(), GeneralUtility\makeInstance(), and Icon\SIZE_SMALL.

Referenced by LiveSearch\findByTable().

getRecordTitlePrep (   $title,
  $titleLength = 0 
)

Crops a title string to a limited length and if it really was cropped, wrap it in a |, which offers a tooltip with the original title when moving mouse over it.

Parameters
string$titleThe title string to be cropped
int$titleLengthCrop title after this length - if not set, BE_USER->uc['titleLen'] is used
Returns
string The processed title string, wrapped in | if cropped

Definition at line 289 of file LiveSearch.php.

References $GLOBALS, MathUtility\canBeInterpretedAsInteger(), and GeneralUtility\fixed_lgd_cs().

getTitleOfCurrentRecordType (   $tableName)
protected

Retrieve the record name

Parameters
string$tableNameRecord table name
Returns
string

Definition at line 275 of file LiveSearch.php.

References $GLOBALS.

Referenced by LiveSearch\getRecordArray().

makeOrderByTable (   $tableName)
protected

Build the MySql ORDER BY statement.

Parameters
string$tableNameRecord table name
Returns
string

Definition at line 368 of file LiveSearch.php.

References $GLOBALS.

Referenced by LiveSearch\findByTable().

makeQuerySearchByTable (   $tableName,
array  $fieldsToSearchWithin 
)
protected

Build the MySql where clause by table.

Parameters
string$tableNameRecord table name
array$fieldsToSearchWithinUser right based visible fields where we can search within.
Returns
string

Definition at line 305 of file LiveSearch.php.

References $GLOBALS, LiveSearch\$queryString, MathUtility\canBeInterpretedAsInteger(), BackendUtility\deleteClause(), elseif, GeneralUtility\inList(), and BackendUtility\versioningPlaceholderClause().

Referenced by LiveSearch\findByTable().

setLimitCount (   $limitCount)

Setter for limit value.

Parameters
int$limitCount
Returns
void

Definition at line 421 of file LiveSearch.php.

References LiveSearch\$limitCount, and MathUtility\convertToPositiveInteger().

setQueryString (   $queryString)

Setter for the search query string.

Parameters
string$queryString
Returns
void
See Also
::removeXSS()

Definition at line 447 of file LiveSearch.php.

References LiveSearch\$queryString, and GeneralUtility\removeXSS().

Referenced by LiveSearch\find().

setStartCount (   $startCount)

Setter for start count value.

Parameters
int$startCount
Returns
void

Definition at line 435 of file LiveSearch.php.

References LiveSearch\$startCount, and MathUtility\convertToPositiveInteger().

Member Data Documentation

$limitCount = 5
private
$queryParser = null
protected

Definition at line 72 of file LiveSearch.php.

$queryString = ''
private

Definition at line 52 of file LiveSearch.php.

Referenced by LiveSearch\makeQuerySearchByTable(), and LiveSearch\setQueryString().

$startCount = 0
private

Definition at line 57 of file LiveSearch.php.

Referenced by LiveSearch\setStartCount().

$userPermissions = ''
protected

Definition at line 67 of file LiveSearch.php.

const GROUP_TITLE_MAX_LENGTH = 15

Definition at line 42 of file LiveSearch.php.

const PAGE_JUMP_TABLE = 'pages'

Definition at line 32 of file LiveSearch.php.

const RECORD_TITLE_MAX_LENGTH = 28

Definition at line 47 of file LiveSearch.php.

const RECURSIVE_PAGE_LEVEL = 99

Definition at line 37 of file LiveSearch.php.