134 lines
3.6 KiB
PHP
Executable file
134 lines
3.6 KiB
PHP
Executable file
<div class="emails view">
|
|
<h2><?php __('Email');?></h2>
|
|
|
|
<dl><?php $i = 0; $class = ' class="altrow"';?>
|
|
|
|
|
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('From'); ?></dt>
|
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
<?php echo $html->link($email['User']['first_name'].' '.$email['User']['last_name'],
|
|
array('controller'=>'users', 'action'=>'view', $email['User']['id'])); ?>
|
|
|
|
<?php echo $html->link($email['User']['email'], array('controller'=>'users','action'=>'view',$email['User']['id'])); ?>
|
|
</dd>
|
|
|
|
|
|
<?php
|
|
if(isset($recipients['to'])):
|
|
foreach($recipients['to'] as $recipient):
|
|
?>
|
|
|
|
<dt<?php if ($i % 2 == 0) echo $class;?>>To</dt>
|
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
<?php echo $html->link($recipient['first_name'].' '.$recipient['last_name'],
|
|
array('controller'=>'users', 'action'=>'view', $recipient['id'])); ?>
|
|
|
|
<?php echo $html->link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?>
|
|
</dd>
|
|
<? endforeach;?>
|
|
<? endif;?>
|
|
|
|
|
|
<?php
|
|
if(isset($recipients['cc'])):
|
|
foreach($recipients['cc'] as $recipient):?>
|
|
|
|
<dt<?php if ($i % 2 == 0) echo $class;?>>cc</dt>
|
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
<?php echo $html->link($recipient['first_name'].' '.$recipient['last_name'],
|
|
array('controller'=>'users', 'action'=>'view', $recipient['id'])); ?>
|
|
|
|
<?php echo $html->link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?>
|
|
</dd>
|
|
<? endforeach;?>
|
|
<? endif;?>
|
|
|
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date'); ?></dt>
|
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
<?php echo date('j M Y @ G:i', $email['Email']['udate']); ?>
|
|
|
|
|
|
</dd>
|
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Subject'); ?></dt>
|
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
<?php echo $email['Email']['subject']; ?>
|
|
|
|
</dd>
|
|
|
|
<? /* <dd class = "emailbody">
|
|
<?php echo $email['Email']['body']; ?>
|
|
|
|
</dd>
|
|
*
|
|
*/?>
|
|
|
|
|
|
</dl>
|
|
</div>
|
|
|
|
|
|
<iframe id="viewHTMLbody" src="/email_attachments/view/<?=$body_ID?>">
|
|
|
|
</iframe>
|
|
|
|
|
|
<div class="related">
|
|
<h3><?=$email['Email']['email_attachment_count']?> Attachments</h3>
|
|
<?php if (!empty($email['EmailAttachment'])):?>
|
|
<table cellpadding = "0" cellspacing = "0">
|
|
<tr>
|
|
|
|
<th><?php __('Name'); ?></th>
|
|
<th><?php __('Type'); ?></th>
|
|
<th><?php __('Size'); ?></th>
|
|
<th class="actions"><?php __('Actions');?></th>
|
|
</tr>
|
|
<?php
|
|
$i = 0;
|
|
foreach ($email['EmailAttachment'] as $emailAttachment):
|
|
$class = null;
|
|
if ($i++ % 2 == 0) {
|
|
$class = ' class="altrow"';
|
|
}
|
|
?>
|
|
<tr<?php echo $class;?>>
|
|
|
|
<td><?php echo $emailAttachment['filename'];?></td>
|
|
<td><?php echo $emailAttachment['type'];?></td>
|
|
<td><?php echo $number->toReadableSize($emailAttachment['size']);?></td>
|
|
|
|
|
|
<td class="actions">
|
|
<?php
|
|
//Allowed types to view in the browser.
|
|
|
|
$allowedTypes = array('text/plain', 'text/html');
|
|
$allowedTypes['text/plain'] = 1;
|
|
$allowedTypes['text/html'] = 1;
|
|
$thisType = $emailAttachment['type'];
|
|
if(isset($allowedTypes[$thisType])) {
|
|
echo '<button id="viewButton">View</button>';
|
|
}
|
|
else {
|
|
echo '<button id="downloadButton">Download</button>';
|
|
//echo $html->link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'download', $emailAttachment['id']));
|
|
} ?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
endforeach; ?>
|
|
</table>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?=debug($recipients);?>
|
|
|
|
<?php
|
|
echo $body_ID;
|
|
echo '<br>';
|
|
debug($email);
|
|
?>
|