X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FFile.php;h=064fa7b263c8f4da40328adc5af04ad70663990e;hb=553ffa22464ff37a28a070458bcd52097b54235f;hp=19a00907b129cc3a47f33cfe9ad786e56742908b;hpb=b2ac9e9ca74be7f852e37e0dfbf0e77627471c4d;p=civicrm-core.git diff --git a/CRM/Core/BAO/File.php b/CRM/Core/BAO/File.php index 19a00907b1..064fa7b263 100644 --- a/CRM/Core/BAO/File.php +++ b/CRM/Core/BAO/File.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -85,7 +85,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File { * * @throws Exception */ - static function filePostProcess( + public static function filePostProcess( $data, $fileTypeID, $entityTable, @@ -211,11 +211,11 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File { /** * The $useWhere is used so that the signature matches the parent class * - public function delete($useWhere = FALSE) { - list($fileID, $entityID, $fieldID) = func_get_args(); - - self::deleteFileReferences($fileID, $entityID, $fieldID); - } */ + * public function delete($useWhere = FALSE) { + * list($fileID, $entityID, $fieldID) = func_get_args(); + * + * self::deleteFileReferences($fileID, $entityID, $fieldID); + * } */ /** * Delete all the files and associated object associated with this @@ -251,7 +251,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File { //delete tags from entity tag table $tagParams = array( 'entity_table' => 'civicrm_file', - 'entity_id' => $fId + 'entity_id' => $fId, ); CRM_Core_BAO_EntityTag::del($tagParams); @@ -323,7 +323,8 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File { } /** - * @param string $entityTable table-name or "*" (to reference files directly by file-id) + * @param string $entityTable + * Table-name or "*" (to reference files directly by file-id). * @param int $entityID * @param int $fileTypeID * @param int $fileID @@ -345,7 +346,8 @@ FROM civicrm_file AS CF LEFT JOIN civicrm_entity_file AS CEF ON ( CEF.file_id = CF.id ) WHERE CF.id = %2"; - } else { + } + else { $sql = " SELECT CF.id as cfID, CF.uri as uri, @@ -440,7 +442,7 @@ AND CEF.entity_id = %2"; $form->addElement('text', "attachDesc_$i", NULL, array( 'size' => 40, 'maxlength' => 255, - 'placeholder' => ts('Description') + 'placeholder' => ts('Description'), )); if (!empty($tags)) { @@ -449,7 +451,7 @@ AND CEF.entity_id = %2"; 'id' => "tags_$i", 'multiple' => 'multiple', 'class' => 'huge crm-select2', - 'placeholder' => ts('- none -') + 'placeholder' => ts('- none -'), ) ); } @@ -461,12 +463,15 @@ AND CEF.entity_id = %2"; * Return a clean url string and the number of attachment for a * given entityTable, entityID * - * @param $entityTable string The entityTable to which the file is attached - * @param $entityID int The id of the object in the above entityTable - * @param $separator string The string separator where to implode the urls + * @param string $entityTable + * The entityTable to which the file is attached. + * @param int $entityID + * The id of the object in the above entityTable. + * @param string $separator + * The string separator where to implode the urls. * - * @return array An array with 2 elements. The string and the number of attachments - * @static + * @return array + * An array with 2 elements. The string and the number of attachments */ public static function attachmentInfo($entityTable, $entityID, $separator = '
') { if (!$entityID) { @@ -490,7 +495,7 @@ AND CEF.entity_id = %2"; * @param $entityTable * @param int $entityID */ - static function formatAttachment( + public static function formatAttachment( &$formValues, &$params, $entityTable, @@ -530,7 +535,7 @@ AND CEF.entity_id = %2"; 'description' => $formValues[$attachDesc], 'upload_date' => $now, 'tag' => $tagParams, - 'attachment_taglist' => CRM_Utils_Array::value($attachFreeTags, $formValues, array()) + 'attachment_taglist' => CRM_Utils_Array::value($attachFreeTags, $formValues, array()), ); $params[$attachName] = $fileParams; @@ -580,11 +585,10 @@ AND CEF.entity_id = %2"; return $names; } - /* + /** * copy/attach an existing file to a different entity * table and id. - */ - /** + * * @param $oldEntityTable * @param int $oldEntityId * @param $newEntityTable @@ -625,7 +629,6 @@ AND CEF.entity_id = %2"; /** * Delete a file attachment from an entity table / entity ID * - * @static */ public static function deleteAttachment() { $params = array(); @@ -647,13 +650,15 @@ AND CEF.entity_id = %2"; /** * Display paper icon for a file attachment -- CRM-13624 * - * @param $entityTable string The entityTable to which the file is attached. eg "civicrm_contact", "civicrm_note", "civicrm_activity" + * @param string $entityTable + * The entityTable to which the file is attached. eg "civicrm_contact", "civicrm_note", "civicrm_activity". * If you have the ID of a specific row in civicrm_file, use $entityTable='*' - * @param $entityID int The id of the object in the above entityTable + * @param int $entityID + * The id of the object in the above entityTable. * - * @return array|NULL list of HTML snippets; one HTML snippet for each attachment. If none found, then NULL + * @return array|NULL + * list of HTML snippets; one HTML snippet for each attachment. If none found, then NULL * - * @static */ public static function paperIconAttachment($entityTable, $entityID) { if (empty($entityTable) || !$entityID) { @@ -664,7 +669,6 @@ AND CEF.entity_id = %2"; foreach ($currentAttachmentInfo as $fileKey => $fileValue) { $fileID = $fileValue['fileID']; $fileType = $fileValue['mime_type']; - $eid = $entityID; if ($fileID) { if ($fileType == 'image/jpeg' || $fileType == 'image/pjpeg' || @@ -712,4 +716,5 @@ AND CEF.entity_id = %2"; } return NULL; } + }