public static function buildAttachment(&$form, $entityTable, $entityID = NULL, $numAttachments = NULL, $ajaxDelete = FALSE) {
if (!$numAttachments) {
- $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
+ $numAttachments = Civi::settings()->get('max_attachments');
}
// Assign maxAttachments count to template for help message
$form->assign('maxAttachments', $numAttachments);
CRM_Core_BAO_File::deleteEntityFile($entityTable, $entityID);
}
- $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
+ $numAttachments = Civi::settings()->get('max_attachments');
$now = date('Ymdhis');
* @param int $entityID
*/
public static function processAttachment(&$params, $entityTable, $entityID) {
- $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
+ $numAttachments = Civi::settings()->get('max_attachments');
for ($i = 1; $i <= $numAttachments; $i++) {
if (
* @return array
*/
public static function uploadNames() {
- $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
+ $numAttachments = Civi::settings()->get('max_attachments');
$names = array();
for ($i = 1; $i <= $numAttachments; $i++) {
$currentAttachmentInfo = self::getEntityFile($entityTable, $entityID);
foreach ($currentAttachmentInfo as $fileKey => $fileValue) {
$fileID = $fileValue['fileID'];
- $fileType = $fileValue['mime_type'];
if ($fileID) {
+ $fileType = $fileValue['mime_type'];
+ $url = $fileValue['url'];
+ $title = $fileValue['cleanName'];
if ($fileType == 'image/jpeg' ||
$fileType == 'image/pjpeg' ||
$fileType == 'image/gif' ||
$fileType == 'image/x-png' ||
$fileType == 'image/png'
) {
- $url = $fileValue['url'];
- $alt = $fileValue['cleanName'];
$file_url[$fileID] = "
- <a href=\"$url\" class='crm-image-popup'>
- <div class='icon paper-icon' title=\"$alt\" alt=\"$alt\"></div>
+ <a href='$url' class='crm-image-popup' title='$title'>
+ <i class='crm-i fa-file-image-o'></i>
</a>";
- // for non image files
}
+ // for non image files
else {
- $url = $fileValue['url'];
- $alt = $fileValue['cleanName'];
- $file_url[$fileID] = "<a href=\"$url\"><div class='icon paper-icon' title=\"$alt\" alt=\"$alt\"></div></a>";
+ $file_url[$fileID] = "
+ <a href='$url' title='$title'>
+ <i class='crm-i fa-paperclip'></i>
+ </a>";
}
}
}