| 
    dolibarr
    x.y.z
    
   | 
 
Class to offer components to list and upload files. More...
Public Member Functions | |
| __construct ($db) | |
| Constructor.  More... | |
| form_attach_new_file ($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile', $accept='', $sectiondir='', $usewithoutform=0, $capture=0, $disablemulti=0, $nooutput=0) | |
| Show form to upload a new file.  More... | |
| show_documents ($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed=0, $modelselected='', $allowgenifempty=1, $forcenomultilang=0, $iconPDF=0, $notused=0, $noform=0, $param='', $title='', $buttonlabel='', $codelang='') | |
| Show the box with list of available documents for object.  More... | |
| showdocuments ($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed=0, $modelselected='', $allowgenifempty=1, $forcenomultilang=0, $iconPDF=0, $notused=0, $noform=0, $param='', $title='', $buttonlabel='', $codelang='', $morepicto='', $object=null, $hideifempty=0, $removeaction='remove_file', $tooltipontemplatecombo='') | |
| Return a string to show the box with list of available documents for object.  More... | |
| getDocumentsLink ($modulepart, $modulesubdir, $filedir, $filter='', $morecss='valignmiddle', $allfiles=0) | |
| Show a Document icon with link(s) You may want to call this into a div like this: print '.  More... | |
| list_of_documents ($filearray, $object, $modulepart, $param='', $forcedownload=0, $relativepath='', $permonobject=1, $useinecm=0, $textifempty='', $maxlength=0, $title='', $url='', $showrelpart=0, $permtoeditline=-1, $upload_dir='', $sortfield='', $sortorder='ASC', $disablemove=1, $addfilterfields=0, $disablecrop=-1, $moreattrondiv='') | |
| Show list of documents in $filearray (may be they are all in same directory but may not) This also sync database if $upload_dir is defined.  More... | |
| list_of_autoecmfiles ($upload_dir, $filearray, $modulepart, $param, $forcedownload=0, $relativepath='', $permissiontodelete=1, $useinecm=0, $textifempty='', $maxlength=0, $url='', $addfilterfields=0) | |
| Show list of documents in a directory of ECM module.  More... | |
| listOfLinks ($object, $permissiontodelete=1, $action=null, $selected=null, $param='') | |
| Show array with linked files.  More... | |
| showPreview ($file, $modulepart, $relativepath, $ruleforpicto=0, $param='') | |
| Show detail icon with link for preview.  More... | |
Class to offer components to list and upload files.
Definition at line 36 of file html.formfile.class.php.
| FormFile::__construct | ( | $db | ) | 
| FormFile::form_attach_new_file | ( | $url, | |
$title = '',  | 
        |||
$addcancel = 0,  | 
        |||
$sectionid = 0,  | 
        |||
$perm = 1,  | 
        |||
$size = 50,  | 
        |||
$object = '',  | 
        |||
$options = '',  | 
        |||
$useajax = 1,  | 
        |||
$savingdocmask = '',  | 
        |||
$linkfiles = 1,  | 
        |||
$htmlname = 'formuserfile',  | 
        |||
$accept = '',  | 
        |||
$sectiondir = '',  | 
        |||
$usewithoutform = 0,  | 
        |||
$capture = 0,  | 
        |||
$disablemulti = 0,  | 
        |||
$nooutput = 0  | 
        |||
| ) | 
Show form to upload a new file.
| string | $url | Url | 
| string | $title | Title zone (Title or '' or 'none') | 
| int | $addcancel | 1=Add 'Cancel' button | 
| int | $sectionid | If upload must be done inside a particular ECM section (is sectionid defined, sectiondir must not be) | 
| int | $perm | Value of permission to allow upload | 
| int | $size | Length of input file area. Deprecated. | 
| Object | $object | Object to use (when attachment is done on an element) | 
| string | $options | Add an option column | 
| integer | $useajax | Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). Deprecated 2 should never be used and if 1 is used, option should not be enabled. | 
| string | $savingdocmask | Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' | 
| integer | $linkfiles | 1=Also add form to link files, 0=Do not show form to link files | 
| string | $htmlname | Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) | 
| string | $accept | Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*') | 
| string | $sectiondir | If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be) | 
| int | $usewithoutform | 0=Default, 1=Disable <form> and <input hidden> to use in existing form area, 2=Disable the tag <form> only | 
| int | $capture | 1=Add tag capture="capture" to force use of micro or video recording to generate file. When setting this to 1, you must also provide a value for $accept. | 
| int | $disablemulti | 0=Default, 1=Disable multiple file upload | 
| int | $nooutput | 0=Output result with print, 1=Return result | 
Definition at line 86 of file html.formfile.class.php.
| FormFile::getDocumentsLink | ( | $modulepart, | |
| $modulesubdir, | |||
| $filedir, | |||
$filter = '',  | 
        |||
$morecss = 'valignmiddle',  | 
        |||
$allfiles = 0  | 
        |||
| ) | 
Show a Document icon with link(s) You may want to call this into a div like this: print '.
';
| string | $modulepart | 'propal', 'facture', 'facture_fourn', ... | 
| string | $modulesubdir | Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. | 
| string | $filedir | Full path to directory to scan | 
| string | $filter | Filter filenames on this regex string (Example: '.pdf$') | 
| string | $morecss | Add more css to the download picto | 
| string | $allfiles | 0=Only generated docs, 1=All files | 
Definition at line 993 of file html.formfile.class.php.
| FormFile::list_of_autoecmfiles | ( | $upload_dir, | |
| $filearray, | |||
| $modulepart, | |||
| $param, | |||
$forcedownload = 0,  | 
        |||
$relativepath = '',  | 
        |||
$permissiontodelete = 1,  | 
        |||
$useinecm = 0,  | 
        |||
$textifempty = '',  | 
        |||
$maxlength = 0,  | 
        |||
$url = '',  | 
        |||
$addfilterfields = 0  | 
        |||
| ) | 
Show list of documents in a directory of ECM module.
| string | $upload_dir | Directory that was scanned. This directory will contains files into subdirs REF/files | 
| array | $filearray | Array of files loaded by dol_dir_list function before calling this function | 
| string | $modulepart | Value for modulepart used by download wrapper. Value can be $object->table_name (that is 'myobject' or 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose) | 
| string | $param | Parameters on sort links | 
| int | $forcedownload | Force to open dialog box "Save As" when clicking on file | 
| string | $relativepath | Relative path of docs (autodefined if not provided) | 
| int | $permissiontodelete | Permission to delete | 
| int | $useinecm | Change output for use in ecm module | 
| int | $textifempty | Text to show if filearray is empty | 
| int | $maxlength | Maximum length of file name shown | 
| string | $url | Full url to use for click links ('' = autodetect) | 
| int | $addfilterfields | Add line with filters | 
Definition at line 1569 of file html.formfile.class.php.
| FormFile::list_of_documents | ( | $filearray, | |
| $object, | |||
| $modulepart, | |||
$param = '',  | 
        |||
$forcedownload = 0,  | 
        |||
$relativepath = '',  | 
        |||
$permonobject = 1,  | 
        |||
$useinecm = 0,  | 
        |||
$textifempty = '',  | 
        |||
$maxlength = 0,  | 
        |||
$title = '',  | 
        |||
$url = '',  | 
        |||
$showrelpart = 0,  | 
        |||
$permtoeditline = -1,  | 
        |||
$upload_dir = '',  | 
        |||
$sortfield = '',  | 
        |||
$sortorder = 'ASC',  | 
        |||
$disablemove = 1,  | 
        |||
$addfilterfields = 0,  | 
        |||
$disablecrop = -1,  | 
        |||
$moreattrondiv = ''  | 
        |||
| ) | 
Show list of documents in $filearray (may be they are all in same directory but may not) This also sync database if $upload_dir is defined.
| array | $filearray | Array of files loaded by dol_dir_list('files') function before calling this. | 
| Object | $object | Object on which document is linked to. | 
| string | $modulepart | Value for modulepart used by download or viewimage wrapper. | 
| string | $param | Parameters on sort links (param must start with &, example &aaa=bbb&ccc=ddd) | 
| int | $forcedownload | Force to open dialog box "Save As" when clicking on file. | 
| string | $relativepath | Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT. | 
| int | $permonobject | Permission on object (so permission to delete or crop document) | 
| int | $useinecm | Change output for use in ecm module: 0 or 6: Add a preview column. Show also a rename button. Show also a crop button for some values of $modulepart (must be supported into hard coded list in this function + photos_resize.php + restrictedArea + checkUserAccessToObject) 1: Add link to edit ECM entry 2: Add rename and crop link 4: Add a preview column 5: Add link to edit ECM entry and Add a preview column | 
| string | $textifempty | Text to show if filearray is empty ('NoFileFound' if not defined) | 
| int | $maxlength | Maximum length of file name shown. | 
| string | $title | Title before list. Use 'none' to disable title. | 
| string | $url | Full url to use for click links ('' = autodetect) | 
| int | $showrelpart | 0=Show only filename (default), 1=Show first level 1 dir | 
| int | $permtoeditline | Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more) | 
| string | $upload_dir | Full path directory so we can know dir relative to MAIN_DATA_ROOT. Fill this to complete file data with database indexes. | 
| string | $sortfield | Sort field ('name', 'size', 'position', ...) | 
| string | $sortorder | Sort order ('ASC' or 'DESC') | 
| int | $disablemove | 1=Disable move button, 0=Position move is possible. | 
| int | $addfilterfields | Add the line with filters | 
| int | $disablecrop | Disable crop feature on images (-1 = auto, prefer to set it explicitely to 0 or 1) | 
| string | $moreattrondiv | More attributes on the div for responsive. Example 'style="height:280px; overflow: auto;"' | 
Definition at line 1132 of file html.formfile.class.php.
| FormFile::listOfLinks | ( | $object, | |
$permissiontodelete = 1,  | 
        |||
$action = null,  | 
        |||
$selected = null,  | 
        |||
$param = ''  | 
        |||
| ) | 
Show array with linked files.
| Object | $object | Object | 
| int | $permissiontodelete | Deletion is allowed | 
| string | $action | Action | 
| string | $selected | ??? | 
| string | $param | More param to add into URL | 
Definition at line 1950 of file html.formfile.class.php.
| FormFile::show_documents | ( | $modulepart, | |
| $modulesubdir, | |||
| $filedir, | |||
| $urlsource, | |||
| $genallowed, | |||
$delallowed = 0,  | 
        |||
$modelselected = '',  | 
        |||
$allowgenifempty = 1,  | 
        |||
$forcenomultilang = 0,  | 
        |||
$iconPDF = 0,  | 
        |||
$notused = 0,  | 
        |||
$noform = 0,  | 
        |||
$param = '',  | 
        |||
$title = '',  | 
        |||
$buttonlabel = '',  | 
        |||
$codelang = ''  | 
        |||
| ) | 
Show the box with list of available documents for object.
| string | $modulepart | propal, facture, facture_fourn, ... | 
| string | $modulesubdir | Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. | 
| string | $filedir | Directory to scan | 
| string | $urlsource | Url of origin page (for return) | 
| int | $genallowed | Generation is allowed (1/0 or array of formats) | 
| int | $delallowed | Remove is allowed (1/0) | 
| string | $modelselected | Model to preselect by default | 
| integer | $allowgenifempty | Show warning if no model activated | 
| integer | $forcenomultilang | Do not show language option (even if MAIN_MULTILANGS defined) | 
| int | $iconPDF | Show only PDF icon with link (1/0) | 
| int | $notused | Not used | 
| integer | $noform | Do not output html form tags | 
| string | $param | More param on http links | 
| string | $title | Title to show on top of form | 
| string | $buttonlabel | Label on submit button | 
| string | $codelang | Default language code to use on lang combo box if multilang is enabled | 
Definition at line 302 of file html.formfile.class.php.
| FormFile::showdocuments | ( | $modulepart, | |
| $modulesubdir, | |||
| $filedir, | |||
| $urlsource, | |||
| $genallowed, | |||
$delallowed = 0,  | 
        |||
$modelselected = '',  | 
        |||
$allowgenifempty = 1,  | 
        |||
$forcenomultilang = 0,  | 
        |||
$iconPDF = 0,  | 
        |||
$notused = 0,  | 
        |||
$noform = 0,  | 
        |||
$param = '',  | 
        |||
$title = '',  | 
        |||
$buttonlabel = '',  | 
        |||
$codelang = '',  | 
        |||
$morepicto = '',  | 
        |||
$object = null,  | 
        |||
$hideifempty = 0,  | 
        |||
$removeaction = 'remove_file',  | 
        |||
$tooltipontemplatecombo = ''  | 
        |||
| ) | 
Return a string to show the box with list of available documents for object.
This also set the property $this->numoffiles
| string | $modulepart | Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...) | 
| string | $modulesubdir | Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into a subdir of module. | 
| string | $filedir | Directory to scan (must not end with a /). Example: '/mydolibarrdocuments/facture/FAYYMM-1234' | 
| string | $urlsource | Url of origin page (for return) | 
| int | string[] | $genallowed | Generation is allowed (1/0 or array list of templates) | 
| int | $delallowed | Remove is allowed (1/0) | 
| string | $modelselected | Model to preselect by default | 
| integer | $allowgenifempty | Allow generation even if list of template ($genallowed) is empty (show however a warning) | 
| integer | $forcenomultilang | Do not show language option (even if MAIN_MULTILANGS defined) | 
| int | $iconPDF | Deprecated, see getDocumentsLink | 
| int | $notused | Not used | 
| integer | $noform | Do not output html form tags | 
| string | $param | More param on http links | 
| string | $title | Title to show on top of form. Example: '' (Default to "Documents") or 'none' | 
| string | $buttonlabel | Label on submit button | 
| string | $codelang | Default language code to use on lang combo box if multilang is enabled | 
| string | $morepicto | Add more HTML content into cell with picto | 
| Object | $object | Object when method is called from an object card. | 
| int | $hideifempty | Hide section of generated files if there is no file | 
| string | $removeaction | (optional) The action to remove a file | 
| string | $tooltipontemplatecombo | Text to show on a tooltip after the combo list of templates | 
Definition at line 337 of file html.formfile.class.php.
| FormFile::showPreview | ( | $file, | |
| $modulepart, | |||
| $relativepath, | |||
$ruleforpicto = 0,  | 
        |||
$param = ''  | 
        |||
| ) | 
Show detail icon with link for preview.
| array | $file | Array with data of file. Example: array('name'=>...) | 
| string | $modulepart | propal, facture, facture_fourn, ... | 
| string | $relativepath | Relative path of docs | 
| integer | $ruleforpicto | Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file). Use a negative value to show a generic picto even if preview not available. | 
| string | $param | More param on http links | 
Definition at line 2094 of file html.formfile.class.php.