PHP Class Search, glpi

Inheritance: extends MY_Controller
Afficher le fichier Open project: glpi-project/glpi Class Usage Examples

Méthodes publiques

Свойство Type Description
$output_type

Méthodes publiques

Méthode 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 méthode

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
Résultat Left join string

addDefaultSelect() static public méthode

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

addDefaultToView() static public méthode

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

addDefaultWhere() static public méthode

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

addHaving() static public méthode

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
Résultat select string

addLeftJoin() static public méthode

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 '')
Résultat Left join string

addMetaLeftJoin() static public méthode

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
Résultat Meta Left join string

addOrderBy() static public méthode

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)
Résultat select string

addSelect() static public méthode

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)
Résultat select string

addWhere() static public méthode

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)
Résultat select string

computeComplexJoinID() static public méthode

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

computeTitle() static public méthode

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

constructDatas() static public méthode

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
Résultat nothing

constructSQL() static public méthode

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
Résultat nothing

csv_clean() static public méthode

Clean display value for csv export
static public csv_clean ( $value ) : clean
$value string value
Résultat clean value

displayConfigItem() static public méthode

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)
Résultat string to print

displayDatas() static public méthode

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

explodeWithID() static public méthode

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

getActionsFor() static public méthode

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

getCleanedOptions() static public méthode

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)
Résultat clean $SEARCH_OPTION array

getDatas() static public méthode

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)
Résultat data array

getLogicalOperators() static public méthode

static public getLogicalOperators ( )

getMetaItemtypeAvailable() static public méthode

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

getMetaReferenceItemtype() static public méthode

static public getMetaReferenceItemtype ( $itemtype )
$itemtype

getOptionNumber() static public méthode

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

getOptions() static public méthode

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

giveItem() static public méthode

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
Résultat string to print

isDeletedSwitch() static public méthode

static public isDeletedSwitch ( $is_deleted ) : string
$is_deleted
Résultat string

isInfocomOption() static public méthode

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

makeTextCriteria() static public méthode

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')
Résultat search SQL string

makeTextSearch() static public méthode

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)
Résultat search string

manageParams() static public méthode

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)
Résultat parsed params array

prepareDatasForSearch() static public méthode

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)
Résultat array prepare to be used for a search (include criterias and others needed informations)

resetSaveSearch() static public méthode

Reset save searches
static public resetSaveSearch ( ) : nothing
Résultat nothing

show() static public méthode

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

showBeginHeader() static public méthode

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

showEndHeader() static public méthode

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

showEndLine() static public méthode

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

showError() static public méthode

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

showFooter() static public méthode

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 '')
Résultat string to display

showGenericSearch() static public méthode

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
Résultat nothing (displays)

showHeader() static public méthode

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)
Résultat string to display

showHeaderItem() static public méthode

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 '')
Résultat string to display

showItem() static public méthode

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 '')
Résultat string to display

showList() static public méthode

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
Résultat nothing

showNewLine() static public méthode

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)
Résultat string to display

sylk_clean() static public méthode

Clean display value for sylk export
static public sylk_clean ( $value ) : clean
$value string value
Résultat clean value

Property Details

$output_type static_oe public_oe property

static public $output_type