本文整理汇总了PHP中CRM_Core_BAO_File::deleteEntityFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_File::deleteEntityFile方法的具体用法?PHP CRM_Core_BAO_File::deleteEntityFile怎么用?PHP CRM_Core_BAO_File::deleteEntityFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_File
的用法示例。
在下文中一共展示了CRM_Core_BAO_File::deleteEntityFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileDelete
function fileDelete()
{
// delete file
$postParams = $_POST;
$fileId = $postParams['fileID'];
CRM_Core_BAO_File::deleteEntityFile($postParams['entityTable'], $postParams['entityID'], $fileTypeID = NULL, $fileId);
CRM_Utils_System::civiExit();
}
示例2: deleteAttachment
/**
* function to delete a file attachment from an entity table / entity ID
*
* @static
* @access public
*/
static function deleteAttachment()
{
$params = array();
$params['entityTable'] = CRM_Utils_Request::retrieve('entityTable', 'String', CRM_Core_DAO::$_nullObject, TRUE);
$params['entityID'] = CRM_Utils_Request::retrieve('entityID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
$params['fileID'] = CRM_Utils_Request::retrieve('fileID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
$signature = CRM_Utils_Request::retrieve('_sgn', 'String', CRM_Core_DAO::$_nullObject, TRUE);
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), self::$_signableFields);
if (!$signer->validate($signature, $params)) {
CRM_Core_Error::fatal('Request signature is invalid');
}
CRM_Core_BAO_File::deleteEntityFile($params['entityTable'], $params['entityID'], NULL, $params['fileID']);
}
示例3: del
/**
* Delete Mails and all its associated records.
*
* @param int $id
* Id of the mail to delete.
*
* @return void
*/
public static function del($id)
{
if (empty($id)) {
CRM_Core_Error::fatal();
}
CRM_Utils_Hook::pre('delete', 'Mailing', $id, CRM_Core_DAO::$_nullArray);
// delete all file attachments
CRM_Core_BAO_File::deleteEntityFile('civicrm_mailing', $id);
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $id;
$dao->delete();
CRM_Core_Session::setStatus(ts('Selected mailing has been deleted.'), ts('Deleted'), 'success');
CRM_Utils_Hook::post('delete', 'Mailing', $id, $dao);
}
示例4: formatAttachment
static function formatAttachment(&$formValues, &$params, $entityTable, $entityID = NULL)
{
// delete current attachments if applicable
if ($entityID && CRM_Utils_Array::value('is_delete_attachment', $formValues)) {
CRM_Core_BAO_File::deleteEntityFile($entityTable, $entityID);
}
$config = CRM_Core_Config::singleton();
$numAttachments = $config->maxAttachments;
$now = date('Ymdhis');
// setup all attachments
for ($i = 1; $i <= $numAttachments; $i++) {
$attachName = "attachFile_{$i}";
if (isset($formValues[$attachName]) && !empty($formValues[$attachName])) {
// we dont care if the file is empty or not
// CRM-7448
$fileParams = array('uri' => $formValues[$attachName]['name'], 'type' => $formValues[$attachName]['type'], 'location' => $formValues[$attachName]['name'], 'upload_date' => $now);
$params[$attachName] = $fileParams;
}
}
}
示例5: del
/**
* Delete Mails and all its associated records
*
* @param int $id id of the mail to delete
*
* @return void
* @access public
* @static
*/
public static function del($id)
{
if (empty($id)) {
CRM_Core_Error::fatal();
}
// delete all file attachments
CRM_Core_BAO_File::deleteEntityFile('civicrm_mailing', $id);
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $id;
$dao->delete();
CRM_Core_Session::setStatus(ts('Selected mailing has been deleted.'));
}
示例6: formatAttachment
static function formatAttachment(&$formValues, &$params, $entityTable, $entityID = null)
{
// delete current attachments if applicable
if ($entityID && CRM_Utils_Array::value('is_delete_attachment', $formValues)) {
CRM_Core_BAO_File::deleteEntityFile($entityTable, $entityID);
}
$config =& CRM_Core_Config::singleton();
$numAttachments = $config->maxAttachments;
// setup all attachments
for ($i = 1; $i <= $numAttachments; $i++) {
$attachName = "attachFile_{$i}";
if (isset($formValues[$attachName]) && !empty($formValues[$attachName])) {
// ensure file is not empty
$contents = file_get_contents($formValues[$attachName]['name']);
if ($contents) {
$fileParams = array('uri' => $formValues[$attachName]['name'], 'type' => $formValues[$attachName]['type'], 'upload_date' => date('Ymdhis'), 'location' => $formValues[$attachName]['name']);
$params[$attachName] = $fileParams;
}
}
}
}
示例7: civicrm_api3_file_delete
/**
* Delete an existing File.
*
* @param array $params
* Array per getfields metadata.
*
* @return array
* API Result Array
*/
function civicrm_api3_file_delete($params)
{
civicrm_api3_verify_mandatory($params, NULL, array('id'));
if (CRM_Core_BAO_File::deleteEntityFile('*', $params['id'])) {
return civicrm_api3_create_success();
} else {
throw new API_Exception('Error while deleting a file.');
}
}
示例8: fileDelete
public static function fileDelete()
{
$postParams = $_GET;
$fileId = $postParams['fileID'];
$result = 0;
CRM_Core_BAO_File::deleteEntityFile($postParams['entityTable'], $postParams['entityID'], $fileTypeID = NULL, $fileId);
list($path) = CRM_Core_BAO_File::path($fileId, $postParams['entityID'], NULL, NULL);
if ($path === null) {
$result = 1;
}
echo html_entity_decode(stripcslashes(json_encode(array('values' => array(array('result' => $result))), true)));
CRM_Utils_System::civiExit();
}