本文整理汇总了PHP中CRM_Core_BAO_File::sql方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_File::sql方法的具体用法?PHP CRM_Core_BAO_File::sql怎么用?PHP CRM_Core_BAO_File::sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_File
的用法示例。
在下文中一共展示了CRM_Core_BAO_File::sql方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileList
public static function fileList()
{
$config = CRM_Core_Config::singleton();
$postParams = $_GET;
$result = array();
$fileID = CRM_Core_BAO_File::getEntityFile($postParams['entityTable'], $postParams['entityID']);
if ($fileID) {
foreach ($fileID as $k => $v) {
$fileType = $v['mime_type'];
$fid = $v['fileID'];
$eid = $postParams['entityID'];
$url = null;
$uri = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_File', $fid, 'uri');
if ($fileType == 'image/jpeg' || $fileType == 'image/pjpeg' || $fileType == 'image/gif' || $fileType == 'image/x-png' || $fileType == 'image/png') {
$url = CRM_Utils_System::url('civicrm/file', "reset=1&id={$fid}&eid={$eid}", FALSE, NULL, TRUE, TRUE);
} else {
$url = CRM_Utils_System::url('civicrm/file', "reset=1&id={$fid}&eid={$eid}");
}
list($sql, $params) = CRM_Core_BAO_File::sql($postParams['entityTable'], $postParams['entityID'], NULL, $v['fileID']);
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$fileSize = 0;
if ($dao->fetch()) {
$fileSize = filesize($config->customFileUploadDir . DIRECTORY_SEPARATOR . $dao->uri);
}
$result[] = array('entityTable' => $postParams['entityTable'], 'entityID' => $eid, 'fileID' => $fid, 'fileType' => $fileType, 'fileSize' => $fileSize, 'name' => $uri, 'url' => $url);
}
}
echo html_entity_decode(stripcslashes(json_encode(array('values' => $result))));
CRM_Utils_System::civiExit();
}