modal.php
130 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | JHtml::fetch('bootstrap.tooltip', '.hasTooltip'); |
| 15 | JHtml::fetch('vaphtml.assets.fontawesome'); |
| 16 | |
| 17 | ?> |
| 18 | |
| 19 | <div class="vap-unotes"> |
| 20 | |
| 21 | <h1><?php echo $this->headingTitle; ?></h1> |
| 22 | |
| 23 | <?php |
| 24 | if (!count($this->rows)) |
| 25 | { |
| 26 | echo VAPApplication::getInstance()->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS')); |
| 27 | } |
| 28 | else |
| 29 | { |
| 30 | ?> |
| 31 | <ul class="alternating"> |
| 32 | <?php |
| 33 | foreach ($this->rows as $note) |
| 34 | { |
| 35 | ?> |
| 36 | <li> |
| 37 | <div class="usernote-title"> |
| 38 | |
| 39 | <h4> |
| 40 | <?php |
| 41 | echo '#' . $note['id'] . ' ' . $note['title']; |
| 42 | |
| 43 | // load tag details |
| 44 | $tags = $this->tagModel->readTags($note['tags'], '*'); |
| 45 | |
| 46 | foreach ($tags as $tag) |
| 47 | { |
| 48 | // render tag |
| 49 | echo JHtml::fetch('vikappointments.tag', $tag, 'icon', array('style' => 'margin-left: 2px;')); |
| 50 | } |
| 51 | ?> |
| 52 | </h4> |
| 53 | |
| 54 | <p class="usernote-date"> |
| 55 | <em> |
| 56 | <?php |
| 57 | if (VAPDateHelper::isNull($note['modifiedon'])) |
| 58 | { |
| 59 | // display creation date |
| 60 | $date = $note['createdon']; |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | // display modify date |
| 65 | $date = $note['modifiedon']; |
| 66 | } |
| 67 | |
| 68 | echo JHtml::fetch('date', $date, 'DATE_FORMAT_LC2'); |
| 69 | ?> |
| 70 | </em> |
| 71 | </p> |
| 72 | |
| 73 | </div> |
| 74 | |
| 75 | <?php |
| 76 | if ($note['content']) |
| 77 | { |
| 78 | ?> |
| 79 | <div class="usernote-content"> |
| 80 | <?php echo $note['content']; ?> |
| 81 | </div> |
| 82 | <?php |
| 83 | } |
| 84 | |
| 85 | // decode note attachments |
| 86 | $files = $note['attachments'] ? (array) json_decode($note['attachments'], true) : array(); |
| 87 | |
| 88 | // get file information |
| 89 | $files = array_filter(array_map(function($file) |
| 90 | { |
| 91 | return AppointmentsHelper::getFileProperties(VAPCUSTOMERS_DOCUMENTS . DIRECTORY_SEPARATOR . $file); |
| 92 | }, $files)); |
| 93 | |
| 94 | if ($files) |
| 95 | { |
| 96 | ?> |
| 97 | <div class="usernote-files"> |
| 98 | <?php |
| 99 | foreach ($files as $file) |
| 100 | { |
| 101 | $pretty = $file['name']; |
| 102 | |
| 103 | if (strlen($pretty) > 24) |
| 104 | { |
| 105 | $pretty = substr($pretty, 0, 11) . '...' . substr($pretty, -10); |
| 106 | } |
| 107 | |
| 108 | ?> |
| 109 | <a href="<?php echo $file['uri']; ?>" target="_blank" class="usernote-attachment"> |
| 110 | <i class="fas fa-paperclip"></i> |
| 111 | <?php echo $pretty; ?> |
| 112 | </a> |
| 113 | <?php |
| 114 | } |
| 115 | ?> |
| 116 | </div> |
| 117 | <?php |
| 118 | } |
| 119 | ?> |
| 120 | </li> |
| 121 | <?php |
| 122 | } |
| 123 | ?> |
| 124 | </ul> |
| 125 | <?php |
| 126 | } |
| 127 | ?> |
| 128 | |
| 129 | </div> |
| 130 |