crm-summit/app/Views/activities_detail.php
mahdahar 45ebd7e0ba fix: align activity file storage
Set activity uploads and links to the public/file tree and ignore that path.
2026-04-14 14:36:58 +07:00

58 lines
1.5 KiB
PHP

<h3>Activity Detail</h3>
<hr>
<?=$content;?>
<?php
$attachment = $attachment['attachment'];
$filelist = $attachment;
$file_array = explode (',', $filelist);
function resolve_attachment_relative_path($filename) {
$uploadRoot = FCPATH . 'file' . DIRECTORY_SEPARATOR;
$pattern = $uploadRoot . '*' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $filename;
$matches = @glob($pattern);
if ($matches !== false) {
foreach ($matches as $match) {
if (is_file($match)) {
$relative = str_replace('\\', '/', substr($match, strlen($uploadRoot)));
return 'file/' . $relative;
}
}
}
return 'file/' . $filename;
}
$i = 1;
foreach ($file_array as $value){
if($i == 1) {echo "<b>Attachment : </b><br/>";}
$trimmedValue = trim($value);
if ($trimmedValue === '') {
$i++;
continue;
}
$relativePath = resolve_attachment_relative_path($trimmedValue);
echo "<a href='".base_url($relativePath)."' target='_blank'>$trimmedValue </a><br/>";
$i++;
}
echo "<br/>";
$i = 1;
foreach ($certificates as $value){
// if($i == 1) {echo "<b>Attachment : </b><br/>";}
echo "Certificate : <a href='".$value['file_url']."' target='_blank'>".$value['cert_name']."</a><br/>";
$i++;
}
echo "<hr/>";
foreach ($actsend_log as $data) {
$logdate = $data['logdate'];
$replyto = $data['replyto'];
$emailto = $data['emailto'];
$emailcc = $data['emailcc'];
$emailbcc = $data['emailbcc'];
echo "<p style='margin-bottom:10px;'><b>$logdate</b><br/>
Reply to : $replyto<br/>
To : $emailto<br/>
cc : $emailcc<br/>
bcc : $emailbcc<br/>
</p>";
}
?>