dolibarr 19.0.3
|
Class to offer components to list and upload files. More...
Public Member Functions | |
__construct ($db) | |
Constructor. | |
form_attach_new_file ($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object=null, $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. | |
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. | |
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. | |
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 '. | |
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. | |
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. | |
listOfLinks ($object, $permissiontodelete=1, $action=null, $selected=null, $param='') | |
Show array with linked files. | |
showPreview ($file, $modulepart, $relativepath, $ruleforpicto=0, $param='') | |
Show detail icon with link for preview. | |
Class to offer components to list and upload files.
Definition at line 36 of file html.formfile.class.php.
FormFile::__construct | ( | $db | ) |
Constructor.
Definition at line 54 of file html.formfile.class.php.
FormFile::form_attach_new_file | ( | $url, | |
$title = '', | |||
$addcancel = 0, | |||
$sectionid = 0, | |||
$perm = 1, | |||
$size = 50, | |||
$object = null, | |||
$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.
References dol_escape_js(), dol_syslog(), getDolGlobalString(), getMaxFileSizeArray(), info_admin(), and load_fiche_titre().
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 |
int | $allfiles | 0=Only generated docs, 1=All files |
Definition at line 1052 of file html.formfile.class.php.
References dol_dir_list(), dol_mimetype(), get_exdir(), getAdvancedPreviewUrl(), getDolGlobalString(), and img_mime().
Referenced by showdocuments().
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 |
string | $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 1649 of file html.formfile.class.php.
References completeFileArrayWithDatabaseInfo(), dol_include_once(), dol_print_size(), dol_sort_array(), dol_syslog(), dol_trunc(), img_mime(), img_picto(), load_fiche_titre(), print_liste_field_titre(), and showPreview().
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 | null | $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 1191 of file html.formfile.class.php.
References ajax_autoselect(), completeFileArrayWithDatabaseInfo(), dol_escape_htmltag(), dol_is_file(), dol_print_size(), dol_sanitizeFileName(), dol_sort_array(), dol_trunc(), get_exdir(), getAdvancedPreviewUrl(), getDolGlobalInt(), getDolGlobalString(), getImageFileNameForSize(), GETPOST(), image_format_supported(), img_delete(), img_down(), img_edit(), img_mime(), img_picto(), img_up(), load_fiche_titre(), print_liste_field_titre(), showPreview(), Product\TYPE_PRODUCT, and Product\TYPE_SERVICE.
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 2031 of file html.formfile.class.php.
References dol_escape_htmltag(), dol_now(), img_delete(), img_edit(), img_picto(), load_fiche_titre(), and print_liste_field_titre().
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.
References showdocuments().
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.
References ajax_autoselect(), ajax_combobox(), completeFileArrayWithDatabaseInfo(), dol_buildpath(), dol_dir_list(), dol_escape_htmltag(), dol_escape_js(), dol_filemtime(), dol_filesize(), dol_mimetype(), dol_print_date(), dol_print_error(), dol_print_size(), dol_sort_array(), dol_syslog(), dol_trunc(), getDocumentsLink(), getDolGlobalInt(), img_mime(), img_picto(), ModeleAction\liste_modeles(), ModeleChequeReceipts\liste_modeles(), ModeleDon\liste_modeles(), ModeleExpenseReport\liste_modeles(), ModelePDFCards\liste_modeles(), ModelePDFCommandes\liste_modeles(), ModelePDFContract\liste_modeles(), ModelePDFDeliveryOrder\liste_modeles(), ModelePDFEvaluation\liste_modeles(), ModelePdfExpedition\liste_modeles(), ModelePDFFactures\liste_modeles(), ModelePDFFicheinter\liste_modeles(), ModelePDFMovement\liste_modeles(), ModelePDFProduct\liste_modeles(), ModelePDFProductBatch\liste_modeles(), ModelePDFProjects\liste_modeles(), ModelePDFPropales\liste_modeles(), ModelePdfReception\liste_modeles(), ModelePDFStock\liste_modeles(), ModelePDFSupplierProposal\liste_modeles(), ModelePDFSuppliersInvoices\liste_modeles(), ModelePDFSuppliersOrders\liste_modeles(), ModelePDFSuppliersPayments\liste_modeles(), ModelePDFTask\liste_modeles(), ModelePDFUser\liste_modeles(), ModelePDFUserGroup\liste_modeles(), ModeleThirdPartyDoc\liste_modeles(), load_fiche_titre(), setEventMessages(), and showPreview().
Referenced by show_documents().
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 2175 of file html.formfile.class.php.
References getAdvancedPreviewUrl(), img_mime(), and img_picto().
Referenced by list_of_autoecmfiles(), list_of_documents(), and showdocuments().