PHP Класс Search, glpi

Наследование: extends MY_Controller
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$output_type

Открытые методы

Метод Описание
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

Описание методов

addDefaultJoin() статический публичный Метод

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
Результат Left join string

addDefaultSelect() статический публичный Метод

Generic Function to add default select to a request
static public addDefaultSelect ( $itemtype ) : select
$itemtype device type
Результат select string

addDefaultToView() статический публичный Метод

Generic Function to add default columns to view
static public addDefaultToView ( $itemtype ) : select
$itemtype device type
Результат select string

addDefaultWhere() статический публичный Метод

Generic Function to add default where to a request
static public addDefaultWhere ( $itemtype ) : select
$itemtype device type
Результат select string

addHaving() статический публичный Метод

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
Результат select string

addLeftJoin() статический публичный Метод

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 '')
Результат Left join string

addMetaLeftJoin() статический публичный Метод

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
Результат Meta Left join string

addOrderBy() статический публичный Метод

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)
Результат select string

addSelect() статический публичный Метод

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)
Результат select string

addWhere() статический публичный Метод

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)
Результат select string

computeComplexJoinID() статический публичный Метод

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

computeTitle() статический публичный Метод

Compute title (use case of PDF OUTPUT)
static public computeTitle ( $data ) : string
$data array data of search
Результат string title

constructDatas() статический публичный Метод

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
Результат nothing

constructSQL() статический публичный Метод

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
Результат nothing

csv_clean() статический публичный Метод

Clean display value for csv export
static public csv_clean ( $value ) : clean
$value string value
Результат clean value

displayConfigItem() статический публичный Метод

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)
Результат string to print

displayDatas() статический публичный Метод

Display datas extracted from DB
static public displayDatas ( array &$data ) : nothing
$data array array of search datas prepared to get datas
Результат nothing

explodeWithID() статический публичный Метод

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

getActionsFor() статический публичный Метод

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

getCleanedOptions() статический публичный Метод

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)
Результат clean $SEARCH_OPTION array

getDatas() статический публичный Метод

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)
Результат data array

getLogicalOperators() статический публичный Метод

static public getLogicalOperators ( )

getMetaItemtypeAvailable() статический публичный Метод

Get meta types available for search engine
static public getMetaItemtypeAvailable ( $itemtype ) : Array
$itemtype type to display the form
Результат Array of available itemtype

getMetaReferenceItemtype() статический публичный Метод

static public getMetaReferenceItemtype ( $itemtype )
$itemtype

getOptionNumber() статический публичный Метод

Get an option number in the SEARCH_OPTION array
static public getOptionNumber ( $itemtype, $field ) : integer
$itemtype
$field name
Результат integer

getOptions() статический публичный Метод

Get the SEARCH_OPTION array
static public getOptions ( $itemtype, $withplugins = true ) : the
$itemtype
$withplugins boolean get search options from plugins (true by default)
Результат the reference to array of search options for the given item type

giveItem() статический публичный Метод

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
Результат string to print

isDeletedSwitch() статический публичный Метод

static public isDeletedSwitch ( $is_deleted ) : string
$is_deleted
Результат string

isInfocomOption() статический публичный Метод

Is the search item related to infocoms
static public isInfocomOption ( $itemtype, $searchID ) : boolean
$itemtype item type
$searchID ID of the element in $SEARCHOPTION
Результат boolean

makeTextCriteria() статический публичный Метод

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')
Результат search SQL string

makeTextSearch() статический публичный Метод

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)
Результат search string

manageParams() статический публичный Метод

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)
Результат parsed params array

prepareDatasForSearch() статический публичный Метод

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)
Результат array prepare to be used for a search (include criterias and others needed informations)

resetSaveSearch() статический публичный Метод

Reset save searches
static public resetSaveSearch ( ) : nothing
Результат nothing

show() статический публичный Метод

Display search engine for an type
static public show ( $itemtype ) : nothing
$itemtype item type to manage
Результат nothing

showBeginHeader() статический публичный Метод

Print begin of header part
static public showBeginHeader ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
Результат string to display

showEndHeader() статический публичный Метод

Print end of header part
static public showEndHeader ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
Результат string to display

showEndLine() статический публичный Метод

Print generic end line
static public showEndLine ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
Результат string to display

showError() статический публичный Метод

Print generic error
static public showError ( $type ) : string
$type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
Результат string to display

showFooter() статический публичный Метод

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 '')
Результат string to display

showGenericSearch() статический публичный Метод

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
Результат nothing (displays)

showHeader() статический публичный Метод

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)
Результат string to display

showHeaderItem() статический публичный Метод

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 '')
Результат string to display

showItem() статический публичный Метод

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 '')
Результат string to display

showList() статический публичный Метод

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
Результат nothing

showNewLine() статический публичный Метод

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)
Результат string to display

sylk_clean() статический публичный Метод

Clean display value for sylk export
static public sylk_clean ( $value ) : clean
$value string value
Результат clean value

Описание свойств

$output_type статическое публичное свойство

static public $output_type