PHP Class Search, glpi

Inheritance: extends MY_Controller
Datei anzeigen Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property Type Description
$output_type

Public Methods

Method Description
addDefaultJoin ( $itemtype, $ref_table, array &$already_link_tables ) : Left Generic Function to add Default left join to a request
addDefaultSelect ( $itemtype ) : select Generic Function to add default select to a request
addDefaultToView ( $itemtype ) : select Generic Function to add default columns to view
addDefaultWhere ( $itemtype ) : select Generic Function to add default where to a request
addHaving ( $LINK, $NOT, $itemtype, $ID, $searchtype, $val, $meta, $num ) : select Generic Function to add GROUP BY to a request
addLeftJoin ( $itemtype, $ref_table, array &$already_link_tables, $new_table, $linkfield, $meta, $meta_type, $joinparams = [], $field = '' ) : Left Generic Function to add left join to a request
addMetaLeftJoin ( $from_type, $to_type, array &$already_link_tables2, $nullornott, $joinparams = [] ) : Meta Generic Function to add left join for meta items
addOrderBy ( $itemtype, $ID, $order, $key ) : select Generic Function to add ORDER BY to a request
addSelect ( $itemtype, $ID, $num, $meta, $meta_type ) : select Generic Function to add select to a request
addWhere ( $link, $nott, $itemtype, $ID, $searchtype, $val, $meta ) : select Generic Function to add where to a request
computeComplexJoinID ( array $joinparams )
computeTitle ( $data ) : string Compute title (use case of PDF OUTPUT)
constructDatas ( array &$data ) : nothing Retrieve datas from DB : construct data array containing columns definitions and rows datas
constructSQL ( array &$data ) : nothing Construct SQL request depending of search parameters
csv_clean ( $value ) : clean Clean display value for csv export
displayConfigItem ( $itemtype, $ID, $data = [], $num ) : string Generic Function to display Items
displayDatas ( array &$data ) : nothing Display datas extracted from DB
explodeWithID ( $pattern, $subject )
getActionsFor ( $itemtype, $field_num )
getCleanedOptions ( $itemtype, $action = READ, $withplugins = true ) : clean Clean search options depending of user active profile
getDatas ( $itemtype, $params, array $forcedisplay = [] ) : data Get datas based on search parameters
getLogicalOperators ( )
getMetaItemtypeAvailable ( $itemtype ) : Array Get meta types available for search engine
getMetaReferenceItemtype ( $itemtype )
getOptionNumber ( $itemtype, $field ) : integer Get an option number in the SEARCH_OPTION array
getOptions ( $itemtype, $withplugins = true ) : the Get the SEARCH_OPTION array
giveItem ( $itemtype, $ID, array $data, $num, $meta, array $addobjectparams = [] ) : string Generic Function to display Items
isDeletedSwitch ( $is_deleted ) : string
isInfocomOption ( $itemtype, $searchID ) : boolean Is the search item related to infocoms
makeTextCriteria ( $field, $val, $not = false, $link = 'AND' ) : search Create SQL search condition
makeTextSearch ( $val, $not = false ) : search Create SQL search condition
manageParams ( $itemtype, $params = [], $usesession = true, $forcebookmark = false ) : parsed Completion of the URL $_GET values with the $_SESSION values or define default values
prepareDatasForSearch ( $itemtype, array $params, array $forcedisplay = [] ) : array Prepare search criteria to be used for a search
resetSaveSearch ( ) : nothing Reset save searches
show ( $itemtype ) : nothing Display search engine for an type
showBeginHeader ( $type ) : string Print begin of header part
showEndHeader ( $type ) : string Print end of header part
showEndLine ( $type ) : string Print generic end line
showError ( $type ) : string Print generic error
showFooter ( $type, $title = "" ) : string Print generic footer
showGenericSearch ( $itemtype, array $params ) : nothing Print generic search form
showHeader ( $type, $rows, $cols, $fixed ) : string Print generic footer
showHeaderItem ( $type, $value, &$num, $linkto = "", $issort, $order = "", $options = "" ) : string Print generic Header Column
showItem ( $type, $value, &$num, $row, $extraparam = '' ) : string Print generic normal Item Cell
showList ( $itemtype, $params ) : nothing Display result table for search engine for an type
showNewLine ( $type, $odd = false, $is_deleted = false ) : string Print generic new line
sylk_clean ( $value ) : clean Clean display value for sylk export

Method Details

addDefaultJoin() static public method

Generic Function to add Default left join to a request
static public addDefaultJoin ( $itemtype, $ref_table, array &$already_link_tables ) : Left
$itemtype reference ID
$ref_table reference table
$already_link_tables array
return Left join string

addDefaultSelect() static public method

Generic Function to add default select to a request
static public addDefaultSelect ( $itemtype ) : select
$itemtype device type
return select string

addDefaultToView() static public method

Generic Function to add default columns to view
static public addDefaultToView ( $itemtype ) : select
$itemtype device type
return select string

addDefaultWhere() static public method

Generic Function to add default where to a request
static public addDefaultWhere ( $itemtype ) : select
$itemtype device type
return select string

addHaving() static public method

Generic Function to add GROUP BY to a request
static public addHaving ( $LINK, $NOT, $itemtype, $ID, $searchtype, $val, $meta, $num ) : select
$LINK link to use
$NOT is is a negative search ?
$itemtype item type
$ID ID of the item to search
$searchtype search type ('contains' or 'equals')
$val value search
$meta is it a meta item ?
$num item number
return select string

addLeftJoin() static public method

Generic Function to add left join to a request
static public addLeftJoin ( $itemtype, $ref_table, array &$already_link_tables, $new_table, $linkfield, $meta, $meta_type, $joinparams = [], $field = '' ) : Left
$itemtype item type
$ref_table reference table
$already_link_tables array array of tables already joined
$new_table new table to join
$linkfield linkfield for LeftJoin
$meta is it a meta item ? (default 0)
$meta_type meta type table (default 0)
$joinparams array join parameters (condition / joinbefore...)
$field string field to display (needed for translation join) (default '')
return Left join string

addMetaLeftJoin() static public method

Generic Function to add left join for meta items
static public addMetaLeftJoin ( $from_type, $to_type, array &$already_link_tables2, $nullornott, $joinparams = [] ) : Meta
$from_type reference item type ID
$to_type item type to add
$already_link_tables2 array array of tables already joined
$nullornott Used LEFT JOIN (null generation) or INNER JOIN for strict join
return Meta Left join string

addOrderBy() static public method

Generic Function to add ORDER BY to a request
static public addOrderBy ( $itemtype, $ID, $order, $key ) : select
$itemtype ID of the device type
$ID field to add
$order order define
$key item number (default 0)
return select string

addSelect() static public method

Generic Function to add select to a request
static public addSelect ( $itemtype, $ID, $num, $meta, $meta_type ) : select
$itemtype item type
$ID ID of the item to add
$num item num in the reque (default 0)
$meta boolean is a meta
$meta_type meta type table ID (default 0)
return select string

addWhere() static public method

Generic Function to add where to a request
static public addWhere ( $link, $nott, $itemtype, $ID, $searchtype, $val, $meta ) : select
$link link string
$nott is it a negative search ?
$itemtype item type
$ID ID of the item to search
$searchtype searchtype used (equals or contains)
$val item num in the request
$meta is a meta search (meta=2 in search.class.php) (default 0)
return select string

computeComplexJoinID() static public method

static public computeComplexJoinID ( array $joinparams )
$joinparams array array

computeTitle() static public method

Compute title (use case of PDF OUTPUT)
static public computeTitle ( $data ) : string
$data array data of search
return string title

constructDatas() static public method

add to data array a field data containing : cols : columns definition rows : rows data
static public constructDatas ( array &$data ) : nothing
$data array array of search datas prepared to get datas
return nothing

constructSQL() static public method

add to data array a field sql containing an array of requests : search : request to get items limited to wanted ones count : to count all items based on search criterias may be an array a request : need to add counts maybe empty : use search one to count
static public constructSQL ( array &$data ) : nothing
$data array array of search datas prepared to generate SQL
return nothing

csv_clean() static public method

Clean display value for csv export
static public csv_clean ( $value ) : clean
$value string value
return clean value

displayConfigItem() static public method

Generic Function to display Items
static public displayConfigItem ( $itemtype, $ID, $data = [], $num ) : string
$itemtype item type
$ID ID of the SEARCH_OPTION item
$data array retrieved data array
$num number of the displayed item (default 0)
return string to print

displayDatas() static public method

Display datas extracted from DB
static public displayDatas ( array &$data ) : nothing
$data array array of search datas prepared to get datas
return nothing

explodeWithID() static public method

static public explodeWithID ( $pattern, $subject )
$pattern
$subject

getActionsFor() static public method

static public getActionsFor ( $itemtype, $field_num )
$itemtype
$field_num

getCleanedOptions() static public method

Clean search options depending of user active profile
static public getCleanedOptions ( $itemtype, $action = READ, $withplugins = true ) : clean
$itemtype item type to manage
$action action which is used to manupulate searchoption (default READ)
$withplugins boolean get plugins options (true by default)
return clean $SEARCH_OPTION array

getDatas() static public method

Get datas based on search parameters
static public getDatas ( $itemtype, $params, array $forcedisplay = [] ) : data
$itemtype item type to manage
$params search params passed to prepareDatasForSearch function
$forcedisplay array array of columns to display (default empty = empty use display pref and search criterias)
return data array

getLogicalOperators() static public method

static public getLogicalOperators ( )

getMetaItemtypeAvailable() static public method

Get meta types available for search engine
static public getMetaItemtypeAvailable ( $itemtype ) : Array
$itemtype type to display the form
return Array of available itemtype

getMetaReferenceItemtype() static public method

static public getMetaReferenceItemtype ( $itemtype )
$itemtype

getOptionNumber() static public method

Get an option number in the SEARCH_OPTION array
static public getOptionNumber ( $itemtype, $field ) : integer
$itemtype
$field name
return integer

getOptions() static public method

Get the SEARCH_OPTION array
static public getOptions ( $itemtype, $withplugins = true ) : the
$itemtype
$withplugins boolean get search options from plugins (true by default)
return the reference to array of search options for the given item type

giveItem() static public method

Generic Function to display Items
static public giveItem ( $itemtype, $ID, array $data, $num, $meta, array $addobjectparams = [] ) : string
$itemtype item type
$ID ID of the SEARCH_OPTION item
$data array array containing data results
$num item num in the request
$meta is a meta item ? (default 0)
$addobjectparams array array added parameters for union search
return string to print

isDeletedSwitch() static public method

static public isDeletedSwitch ( $is_deleted ) : string
$is_deleted
return string

isInfocomOption() static public method

Is the search item related to infocoms
static public isInfocomOption ( $itemtype, $searchID ) : boolean
$itemtype item type
$searchID ID of the element in $SEARCHOPTION
return boolean

makeTextCriteria() static public method

Create SQL search condition
static public makeTextCriteria ( $field, $val, $not = false, $link = 'AND' ) : search
$field name (should be ` protected)
$val string value to search
$not boolean is a negative search ? (false by default)
$link with previous criteria (default 'AND')
return search SQL string

makeTextSearch() static public method

Create SQL search condition
static public makeTextSearch ( $val, $not = false ) : search
$val string value to search
$not boolean is a negative search ? (false by default)
return search string

manageParams() static public method

Completion of the URL $_GET values with the $_SESSION values or define default values
static public manageParams ( $itemtype, $params = [], $usesession = true, $forcebookmark = false ) : parsed
$itemtype item type to manage
$params array params to parse
$usesession Use datas save in session (true by default)
$forcebookmark force trying to load parameters from default bookmark: used for global search (false by default)
return parsed params array

prepareDatasForSearch() static public method

Prepare search criteria to be used for a search
static public prepareDatasForSearch ( $itemtype, array $params, array $forcedisplay = [] ) : array
$itemtype item type
$params array array of parameters may include sort, order, start, list_limit, deleted, criteria, metacriteria
$forcedisplay array array of columns to display (default empty = empty use display pref and search criterias)
return array prepare to be used for a search (include criterias and others needed informations)

resetSaveSearch() static public method

Reset save searches
static public resetSaveSearch ( ) : nothing
return nothing

show() static public method

Display search engine for an type
static public show ( $itemtype ) : nothing
$itemtype item type to manage
return nothing

showBeginHeader() static public method

Print begin of header part
static public showBeginHeader ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
return string to display

showEndHeader() static public method

Print end of header part
static public showEndHeader ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
return string to display

showEndLine() static public method

Print generic end line
static public showEndLine ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
return string to display

showError() static public method

Print generic error
static public showError ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
return string to display

showFooter() static public method

Print generic footer
static public showFooter ( $type, $title = "" ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
$title title of file : used for PDF (default '')
return string to display

showGenericSearch() static public method

Params need to parsed before using Search::manageParams function
static public showGenericSearch ( $itemtype, array $params ) : nothing
$itemtype type to display the form
$params array array of parameters may include sort, is_deleted, criteria, metacriteria
return nothing (displays)

showHeader() static public method

Print generic footer
static public showHeader ( $type, $rows, $cols, $fixed ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
$rows number of rows
$cols number of columns
$fixed used tab_cadre_fixe table for HTML export ? (default 0)
return string to display

showHeaderItem() static public method

Print generic Header Column
static public showHeaderItem ( $type, $value, &$num, $linkto = "", $issort, $order = "", $options = "" ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
$value value to display
$linkto link display element (HTML specific) (default '')
$issort is the sort column ? (default 0)
$order order type ASC or DESC (defaut '')
$options string options to add (default '')
return string to display

showItem() static public method

Print generic normal Item Cell
static public showItem ( $type, $value, &$num, $row, $extraparam = '' ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
$value value to display
$row row number
$extraparam extra parameters for display (default '')
return string to display

showList() static public method

Display result table for search engine for an type
static public showList ( $itemtype, $params ) : nothing
$itemtype item type to manage
$params search params passed to prepareDatasForSearch function
return nothing

showNewLine() static public method

Print generic new line
static public showNewLine ( $type, $odd = false, $is_deleted = false ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
$odd is it a new odd line ? (false by default)
$is_deleted is it a deleted search ? (false by default)
return string to display

sylk_clean() static public method

Clean display value for sylk export
static public sylk_clean ( $value ) : clean
$value string value
return clean value

Property Details

$output_type static_oe public_oe property

static public $output_type