<?php foreach ($attachments as $a) { $file_path = sfConfig::get('sf_upload_dir') . '/attachments/' . $a->getFile(); ?> <div id="attachedFile<?php echo $a->getId(); ?> "> <table> <tr> <td colspan="2"><?php echo Attachments::getFileIcon($a->getFile()) . ' ' . (is_file($file_path) ? getimagesize($file_path) ? link_to(substr($a->getFile(), 7), 'attachments/view?id=' . $a->getId(), array('target' => '_blank', 'absolute' => true)) : Attachments::getLink($a) : substr($a->getFile(), 7)); ?> </td> </tr> </tr> <?php if ($a->getBindType() != 'wiki') { ?> <td><?php echo __('Description') . ':</td><td> ' . textarea_tag('attachments_info[' . $a->getId() . ']', $a->getInfo(), array('style' => 'height: 50px;', 'class' => 'attachments_textarea')); ?> </td> <?php } ?> <td><a href="#" onClick="return deleteAttachments(<?php echo $a->getId(); ?>
<?php $html = ''; $related_attachments = array(); foreach ($attachments as $v) { $file_path = sfConfig::get('sf_upload_dir') . '/attachments/' . $v['file']; if (is_file($file_path)) { if (getimagesize($file_path)) { $html .= '<li>' . Attachments::getFileIcon($v['file']) . ' ' . link_to(substr($v['file'], 7), 'attachments/view?id=' . $v['id'], array('target' => '_blank', 'absolute' => true)) . ' ' . link_to(image_tag(public_path('images/icons/zoom.png', true), array('border' => 0)) . ' ' . __('view'), 'attachments/view?id=' . $v['id'], array('target' => '_blank', 'style' => 'text-decoration:none', 'absolute' => true)) . ' ' . link_to(image_tag(public_path('images/icons/download.png', true), array('border' => 0)) . ' ' . __('download'), 'attachments/download?id=' . $v['id'], array('style' => 'text-decoration:none', 'absolute' => true)) . ' ' . $v['info'] . '</li>' . "\n"; } else { $html .= '<li>' . Attachments::getFileIcon($v['file']) . ' ' . link_to(substr($v['file'], 7), 'attachments/download?id=' . $v['id'], array('absolute' => true)) . ' ' . link_to(image_tag(public_path('images/icons/download.png', true), array('border' => 0)) . ' ' . __('download'), 'attachments/download?id=' . $v['id'], array('style' => 'text-decoration:none', 'absolute' => true)) . ' ' . $v['info'] . '</li>' . "\n"; } $related_attachments[] = $v['id']; } } if (strlen($html) > 0) { ?> <br><?php echo __('Attachments'); ?> : <ul class="attachedList" id="attachedList"> <?php echo $html; ?> </ul> <?php echo input_hidden_tag('item_attachments', implode(',', $related_attachments)); } ?>