attachments.php
44 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Display attachments |
| 4 | * |
| 5 | * @since v.1.0.0 |
| 6 | * @author themeum |
| 7 | * @url https://themeum.com |
| 8 | * |
| 9 | * |
| 10 | * @package TutorLMS/Templates |
| 11 | * @version 1.4.3 |
| 12 | */ |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) |
| 15 | exit; |
| 16 | |
| 17 | $attachments = tutor_utils()->get_attachments(); |
| 18 | $open_mode_view = apply_filters('tutor_pro_attachment_open_mode', null)=='view' ? ' target="_blank" ' : null; |
| 19 | |
| 20 | do_action('tutor_global/before/attachments'); |
| 21 | |
| 22 | if (is_array($attachments) && count($attachments)){ |
| 23 | ?> |
| 24 | <div class="tutor-page-segment tutor-attachments-wrap"> |
| 25 | <h3><?php _e('Attachments', 'tutor'); ?></h3> |
| 26 | <?php |
| 27 | foreach ($attachments as $attachment){ |
| 28 | ?> |
| 29 | <a href="<?php echo $attachment->url; ?>" <?php echo ($open_mode_view ?? ' download="'.$attachment->name.'" ' ); ?> class="tutor-lesson-attachment clearfix"> |
| 30 | <div class="tutor-attachment-icon"> |
| 31 | <i class="tutor-icon-<?php echo $attachment->icon; ?>"></i> |
| 32 | </div> |
| 33 | <div class="tutor-attachment-info"> |
| 34 | <span><?php echo $attachment->name; ?></span> |
| 35 | <span><?php echo $attachment->size; ?></span> |
| 36 | </div> |
| 37 | </a> |
| 38 | <?php |
| 39 | } |
| 40 | ?> |
| 41 | </div> |
| 42 | <?php } |
| 43 | |
| 44 | do_action('tutor_global/after/attachments'); ?> |