PHP Class Document, glpi

Inheritance: extends CommonDBTM
Show file Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property Type Description
$dohistory From CommonDBTM
$rightname
$tag_prefix

Protected Properties

Property Type Description
$forward_entity_to
$usenotepad

Public Methods

Method Description
canApplyOn ( $item ) : true Check if given object can have Document
canCreate ( )
canCreateItem ( )
canViewFile ( $options ) : boolean Check is the curent user is allowed to see the file
cleanDBonPurge ( )
defineTabs ( $options = [] )
dropdown ( $options = [] ) : nothing Make a select box for link document
getDownloadLink ( $params = '', $len = 20 ) Get download link for a document
getFromDBbyContent ( $entity, $path ) : boolean find a document with a file attached
getImageTag ( $string ) : string
getItemtypesThatCanHave ( ) : array Get all the types that can have a document
getMassiveActionsForItemtype ( array &$actions, $itemtype, $is_deleted, CommonDBTM $checkitem = NULL )
getMaxUploadSize ( ) Get max upload size from php config
getMenuShorcut ( )
getSearchOptions ( )
getSearchOptionsToAdd ( )
getSpecificMassiveActions ( $checkitem = NULL )
getTypeName ( $nb )
getUploadFileValidLocationName ( $dir, $sha1sum ) : nothing Find a valid path for the new file
isValidDoc ( $filename ) Is this file a valid file ? check based on file extension
moveDocument ( array &$input, $filename ) : boolean Move a document (files in GLPI_DOC_DIR."/_tmp" dir)
moveUploadedDocument ( array &$input, $filename ) : boolean Move an uploadd document (files in GLPI_DOC_DIR."/_uploads" dir)
post_addItem ( )
prepareInputForAdd ( $input )
prepareInputForUpdate ( $input )
renameForce ( $srce, $dest ) : boolean Move a file to a new location Work even if dest file already exists
send ( ) Send a document to navigator
showForm ( $ID, $options = [] ) : Nothing Print the document form
showUploadedFilesDropdown ( $myname ) Show dropdown of uploaded files
uploadDocument ( array &$input, $FILEDESC ) : true Upload a new file

Method Details

canApplyOn() static public method

Check if given object can have Document
static public canApplyOn ( $item ) : true
$item an object or a string
return true if $object is an object that can have InfoCom

canCreate() static public method

static public canCreate ( )

canCreateItem() public method

public canCreateItem ( )

canViewFile() public method

Check is the curent user is allowed to see the file
public canViewFile ( $options ) : boolean
$options array of options (only 'tickets_id' used)
return boolean

cleanDBonPurge() public method

public cleanDBonPurge ( )

defineTabs() public method

public defineTabs ( $options = [] )

dropdown() static public method

Parameters which could be used in options array : - name : string / name of the select (default is documents_id) - entity : integer or array / restrict to a defined entity or array of entities (default -1 : no restriction) - used : array / Already used items ID: not to display in dropdown (default empty)
static public dropdown ( $options = [] ) : nothing
$options array of possible options
return nothing (print out an HTML select box)

getFromDBbyContent() public method

find a document with a file attached
public getFromDBbyContent ( $entity, $path ) : boolean
$entity of the document
$path of the searched file
return boolean

getImageTag() static public method

static public getImageTag ( $string ) : string
$string
return string

getItemtypesThatCanHave() static public method

Get all the types that can have a document
static public getItemtypesThatCanHave ( ) : array
return array of the itemtypes

getMassiveActionsForItemtype() static public method

See also: CommonDBTM::getMassiveActionsForItemtype()
static public getMassiveActionsForItemtype ( array &$actions, $itemtype, $is_deleted, CommonDBTM $checkitem = NULL )
$actions array
$checkitem CommonDBTM

getMaxUploadSize() static public method

Get max upload size from php config
static public getMaxUploadSize ( )

getMenuShorcut() static public method

See also: CommonGLPI::getMenuShorcut()
static public getMenuShorcut ( )

getSearchOptions() public method

public getSearchOptions ( )

getSearchOptionsToAdd() static public method

static public getSearchOptionsToAdd ( )

getSpecificMassiveActions() public method

See also: CommonDBTM::getSpecificMassiveActions()
public getSpecificMassiveActions ( $checkitem = NULL )

getTypeName() static public method

static public getTypeName ( $nb )

getUploadFileValidLocationName() static public method

Find a valid path for the new file
static public getUploadFileValidLocationName ( $dir, $sha1sum ) : nothing
$dir dir to search a free path for the file
$sha1sum SHA1 of the file
return nothing

isValidDoc() static public method

Is this file a valid file ? check based on file extension
static public isValidDoc ( $filename )
$filename filename to clean

moveDocument() static public method

Move a document (files in GLPI_DOC_DIR."/_tmp" dir)
static public moveDocument ( array &$input, $filename ) : boolean
$input array array of datas used in adding process (need current_filepath)
$filename filename to move
return boolean for success / $input array is updated

moveUploadedDocument() static public method

Move an uploadd document (files in GLPI_DOC_DIR."/_uploads" dir)
static public moveUploadedDocument ( array &$input, $filename ) : boolean
$input array array of datas used in adding process (need current_filepath)
$filename filename to move
return boolean for success / $input array is updated

post_addItem() public method

public post_addItem ( )

prepareInputForAdd() public method

See also: CommonDBTM::prepareInputForAdd()
public prepareInputForAdd ( $input )

prepareInputForUpdate() public method

See also: CommonDBTM::prepareInputForUpdate()
public prepareInputForUpdate ( $input )

renameForce() static public method

Move a file to a new location Work even if dest file already exists
static public renameForce ( $srce, $dest ) : boolean
$srce source file path
$dest destination file path
return boolean : success

send() public method

Send a document to navigator
public send ( )

showForm() public method

Print the document form
public showForm ( $ID, $options = [] ) : Nothing
$ID integer ID of the item
$options array - target filename : where to go when done. - withtemplate boolean : template or basic item
return Nothing (display)

showUploadedFilesDropdown() static public method

Show dropdown of uploaded files
static public showUploadedFilesDropdown ( $myname )
$myname dropdown name

uploadDocument() static public method

Upload a new file
static public uploadDocument ( array &$input, $FILEDESC ) : true
$input array
$FILEDESC FILE descriptor
return true on success

Property Details

$dohistory public property

From CommonDBTM
public $dohistory

$forward_entity_to protected static property

protected static $forward_entity_to

$rightname static public property

static public $rightname

$tag_prefix static public property

static public $tag_prefix

$usenotepad protected property

protected $usenotepad