/** * input_field callback * @return string */ public function generateFileUploadField() { // generate the attached files listing $objDb = $this->Database->prepare('SELECT attachment FROM tl_be_email WHERE id=?')->execute(\Input::get('id')); $strAttachments = ''; if ($objDb->attachment != '' && count(unserialize($objDb->attachment)) > 0) { $arrFiles = unserialize($objDb->attachment); $arrOptions = array(); foreach ($arrFiles as $fileKey => $fileName) { $file = new File(BE_EMAIL_UPLOAD_DIR . '/' . $fileKey); $arrOptions[] = array('value' => $fileKey, 'label' => specialchars($fileName . ' [' . $this->getReadableSize($file->size) . ']')); } if (count($arrFiles)) { $widget = new FormCheckBox(); $widget->name = 'attachment'; $widget->class = 'attachmentList'; $widget->options = serialize($arrOptions); $widget->addSubmit = true; $widget->slabel = $GLOBALS['TL_LANG']['tl_be_email']['removeAttachments'][0]; $strAttachments .= '<h3><label>' . $GLOBALS['TL_LANG']['tl_be_email']['emailAttachments'][0] . '</label></h3>'; $strAttachments .= $widget->generate(); } } // generate the fileupload form field $widget = new FormFileUpload(); $widget->id = 'fileupload'; $widget->name = 'file'; $widget->class = 'tl_upload_file'; $widget->label = $GLOBALS['TL_LANG']['tl_be_email']['fileupload'][0]; $widget->slabel = 'upload'; $widget->addSubmit = true; $widget->maxlength = $GLOBALS['TL_CONFIG']['maxFileSize']; $strFileuploader = $widget->generateLabel() . $widget->generate(); // return the html $html = '<div id="attachmentBox">%s%s</div>'; return sprintf($html, $strAttachments, $strFileuploader); }