Merge pull request #2326 from eileenmcnaughton/CRM-14069
[civicrm-core.git] / CRM / Core / BAO / File.php
index 475f668c669d178d28b3e09a0d5aac0648fc3694..db765e5627b5842333c1566240351904aa3a1c11 100644 (file)
 
    static $_signableFields = array('entityTable', 'entityID', 'fileID');
 
+   /**
+    * @param $fileID
+    * @param $entityID
+    * @param null $entityTable
+    *
+    * @return array
+    */
    static function path($fileID, $entityID, $entityTable = NULL) {
      $entityFileDAO = new CRM_Core_DAO_EntityFile();
      if ($entityTable) {
    }
 
 
+   /**
+    * @param $data
+    * @param $fileTypeID
+    * @param $entityTable
+    * @param $entityID
+    * @param $entitySubtype
+    * @param bool $overwrite
+    * @param null $fileParams
+    * @param string $uploadName
+    * @param null $mimeType
+    *
+    * @throws Exception
+    */
    static function filePostProcess(
      $data,
      $fileTypeID,
      return $results;
    }
 
+   /**
+    * @param $entityTable
+    * @param $entityID
+    * @param null $fileTypeID
+    * @param null $fileID
+    *
+    * @return array
+    */
    static function sql($entityTable, $entityID, $fileTypeID = NULL, $fileID = NULL) {
      $sql = "
  SELECT    CF.id as cfID,
      return array($sql, $params);
    }
 
+   /**
+    * @param $form
+    * @param $entityTable
+    * @param null $entityID
+    * @param null $numAttachments
+    * @param bool $ajaxDelete
+    */
    static function buildAttachment(&$form, $entityTable, $entityID = NULL, $numAttachments = NULL, $ajaxDelete = FALSE) {
 
      if (!$numAttachments) {
          'maxfilesize',
          $maxFileSize * 1024 * 1024
        );
-       $form->addElement('text', "attachDesc_$i", ts('Description'), 'size=40 maxlength=255');
+       $form->addElement('text', "attachDesc_$i", NULL, array('size' => 40, 'maxlength' => 255, 'placeholder' => ts('Description')));
 
        if (!empty($tags)) {
          $form->add('select', "tag_$i", ts('Tags'), $tags, FALSE,
-           array('id' => "tags_$i", 'multiple' => 'multiple', 'class' => 'crm-select2')
+           array('id' => "tags_$i", 'multiple' => 'multiple', 'class' => 'huge crm-select2', 'placeholder' => ts('- none -'))
          );
        }
+       CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_file', NULL, FALSE, TRUE, "file_taglist_$i");
      }
-
-     // build tagset widget
-     CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_file', NULL, TRUE, TRUE, FALSE);
    }
 
    /**
      return NULL;
    }
 
+   /**
+    * @param $formValues
+    * @param $params
+    * @param $entityTable
+    * @param null $entityID
+    */
    static function formatAttachment(
      &$formValues,
      &$params,
        $attachName = "attachFile_$i";
        $attachDesc = "attachDesc_$i";
        $attachTags = "tag_$i";
-       $attachFreeTags = "attachment_taglist_$i";
+       $attachFreeTags = "file_taglist_$i";
        if (isset($formValues[$attachName]) && !empty($formValues[$attachName])) {
          // add static tags if selects
          $tagParams = array();
      }
    }
 
+   /**
+    * @param $params
+    * @param $entityTable
+    * @param $entityID
+    */
    static function processAttachment(&$params, $entityTable, $entityID) {
      $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
 
      }
    }
 
+   /**
+    * @return array
+    */
    static function uploadNames() {
      $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
 
     * Function to copy/attach an existing file to a different entity
     * table and id.
     */
+   /**
+    * @param $oldEntityTable
+    * @param $oldEntityId
+    * @param $newEntityTable
+    * @param $newEntityId
+    */
    static function copyEntityFile($oldEntityTable, $oldEntityId, $newEntityTable, $newEntityId) {
     $oldEntityFile = new CRM_Core_DAO_EntityFile();
     $oldEntityFile->entity_id = $oldEntityId;
     }
   }
 
-  static function deleteURLArgs($entityTable, $entityID, $fileID) {
+   /**
+    * @param $entityTable
+    * @param $entityID
+    * @param $fileID
+    *
+    * @return string
+    */
+   static function deleteURLArgs($entityTable, $entityID, $fileID) {
     $params['entityTable'] = $entityTable;
     $params['entityID']    = $entityID;
     $params['fileID']      = $fileID;