}
/**
- * A static function wrapper that deletes the various objects that are
- * connected to a file object (i.e. file, entityFile and customValue
+ * A static function wrapper that deletes the various objects.
+ *
+ * Objects are those hat are connected to a file object (i.e. file, entityFile and customValue.
+ *
+ * @param int $fileID
+ * @param int $entityID
+ * @param int $fieldID
+ *
+ * @throws \Exception
*/
public static function deleteFileReferences($fileID, $entityID, $fieldID) {
$fileDAO = new CRM_Core_DAO_File();
* } */
/**
- * Delete all the files and associated object associated with this
- * combination
+ * Delete all the files and associated object associated with this combination.
+ *
+ * @param string $entityTable
+ * @param int $entityID
+ * @param int $fileTypeID
+ * @param int $fileID
+ *
* @return bool
* Was file deleted?
*/
}
/**
- * Get all the files and associated object associated with this
- * combination
+ * Get all the files and associated object associated with this combination.
+ *
+ * @param string $entityTable
+ * @param int $entityID
+ * @param bool $addDeleteArgs
+ *
+ * @return array|null
*/
public static function getEntityFile($entityTable, $entityID, $addDeleteArgs = FALSE) {
if (empty($entityTable) || !$entityID) {
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>";
}
}
}