|
dolibarr
13.0.2
|
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) | |
| 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') | |
| Return a string to show the box with list of available documents for object. More... | |
| getDocumentsLink ($modulepart, $modulesubdir, $filedir, $filter= '') | |
| 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) | |
| 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... | |
Private Member Functions | |
| _formAjaxFileUpload ($object) | |
| Show form to upload a new file with jquery fileupload. More... | |
Class to offer components to list and upload files.
Definition at line 36 of file html.formfile.class.php.
| FormFile::__construct | ( | $db | ) |
|
private |
Show form to upload a new file with jquery fileupload.
This form use the fileupload.php file.
| Object | $object | Object to use |
Definition at line 1728 of file html.formfile.class.php.
Referenced by form_attach_new_file().
| 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 |
|||
| ) |
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 no 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 style to use in existing area |
| 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 |
Definition at line 85 of file html.formfile.class.php.
References _formAjaxFileUpload(), dol_escape_js(), dol_syslog(), info_admin(), load_fiche_titre(), and print.
| FormFile::getDocumentsLink | ( | $modulepart, | |
| $modulesubdir, | |||
| $filedir, | |||
$filter = '' |
|||
| ) |
Show a Document icon with link(s) You may want to call this into a div like this: print '
$formfile->getDocumentsLink($element_doc, $filename, $filedir).'';
| 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$') |
Definition at line 904 of file html.formfile.class.php.
References dol_dir_list(), dol_mimetype(), get_exdir(), getAdvancedPreviewUrl(), 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 |
| 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 1428 of file html.formfile.class.php.
References $_SERVER, completeFileArrayWithDatabaseInfo(), db, dol_print_size(), dol_sort_array(), dol_syslog(), dol_trunc(), img_mime(), img_picto(), load_fiche_titre(), print, 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 |
|||
| ) |
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 line with filters |
| int | $disablecrop | Disable crop feature on images (-1 = auto, prefer to set it explicitely to 0 or 1) |
Definition at line 1037 of file html.formfile.class.php.
References $_SERVER, ajax_autoselect(), completeFileArrayWithDatabaseInfo(), db, dol_escape_htmltag(), dol_is_file(), dol_print_size(), dol_sanitizeFileName(), dol_sort_array(), dol_trunc(), get_exdir(), getAdvancedPreviewUrl(), getImageFileNameForSize(), GETPOST(), image_format_supported(), img_delete(), img_down(), img_edit(), img_mime(), img_picto(), img_up(), load_fiche_titre(), newToken(), print, 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 1762 of file html.formfile.class.php.
References $_SERVER, db, dol_escape_htmltag(), dol_now(), img_delete(), img_edit(), img_picto(), load_fiche_titre(), newToken(), print, 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 311 of file html.formfile.class.php.
References print, and 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' |
|||
| ) |
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:nameofsubmodule', '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 subdir of module. |
| string | $filedir | Directory to scan |
| 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 |
Definition at line 345 of file html.formfile.class.php.
References ajax_combobox(), db, dol_buildpath(), dol_dir_list(), dol_escape_js(), dol_filemtime(), dol_filesize(), dol_mimetype(), dol_print_date(), dol_print_error(), dol_syslog(), dol_trunc(), getDocumentsLink(), img_mime(), ModelePDFSuppliersPayments\liste_modeles(), ModelePDFStock\liste_modeles(), ModeleExpenseReport\liste_modeles(), ModelePdfReception\liste_modeles(), ModeleAction\liste_modeles(), ModelePDFMovement\liste_modeles(), ModeleThirdPartyDoc\liste_modeles(), ModelePDFTask\liste_modeles(), ModelePDFProduct\liste_modeles(), ModeleDon\liste_modeles(), ModelePDFCommandes\liste_modeles(), ModelePDFSuppliersInvoices\liste_modeles(), ModelePDFFicheinter\liste_modeles(), ModelePDFCards\liste_modeles(), ModelePDFDeliveryOrder\liste_modeles(), ModelePDFSupplierProposal\liste_modeles(), ModelePDFPropales\liste_modeles(), ModelePDFSuppliersOrders\liste_modeles(), ModelePDFContract\liste_modeles(), ModeleExports\liste_modeles(), ModelePDFProductBatch\liste_modeles(), ModelePDFUserGroup\liste_modeles(), ModelePDFUser\liste_modeles(), ModelePDFFactures\liste_modeles(), ModelePDFProjects\liste_modeles(), ModeleChequeReceipts\liste_modeles(), load_fiche_titre(), 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) |
| string | $param | More param on http links |
Definition at line 1907 of file html.formfile.class.php.
References getAdvancedPreviewUrl(), and img_mime().
Referenced by list_of_autoecmfiles(), list_of_documents(), and showdocuments().