feat: Fixes #6772 adds twig email templates to emails (#6773)
[openemr.git] / interface / main / onotes / office_comments.php
blobd06ea28cb1aa912e74bc86846fe11970d617be88
1 <?php
3 /**
4 * Viewing of office notes.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../../globals.php");
15 use OpenEMR\Common\Acl\AclMain;
16 use OpenEMR\Common\Twig\TwigContainer;
17 use OpenEMR\Core\Header;
18 use OpenEMR\Services\ONoteService;
20 // Control access
21 if (!AclMain::aclCheckCore('encounters', 'notes')) {
22 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Office Notes")]);
23 exit;
26 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
27 $N = 10;
29 $oNoteService = new ONoteService();
32 <html>
33 <head>
35 <?php Header::setupHeader(); ?>
37 </head>
38 <body class="body_top">
40 <div id="officenotes_list">
41 <a href="office_comments_full.php" onclick='top.restoreSession()'>
42 <font class="title"><?php echo xlt('Office Notes'); ?></font>
43 <font class="more"><?php echo text($tmore);?></font></a>
45 <br />
47 <table border=0 width=100%>
49 <?php
51 $notes = $oNoteService->getNotes(1, 0, ($N + 1));
53 //retrieve all active notes
54 if (!empty($notes)) {
55 $notes_count = 0;//number of notes so far displayed
56 foreach ($notes as $note) {
57 if ($notes_count >= $N) {
58 //we have more active notes to print, but we've reached our display maximum (defined at top of this file)
59 $notice = '';
60 $notice .= '<div class="alert alert-info">';
61 $notice .= ' <a href=\'office_comments_full.php?active=-1\' onclick=\'top.restoreSession()\'>' . xlt("Some office notes were not displayed. Click here to view all.") . '</a>';
62 $notice .= '</div>';
63 print $notice;
64 break;
67 $date = (new DateTime($note['date']))->format('Y-m-d');
69 $todaysDate = new DateTime();
70 if ($todaysDate->format('Y-m-d') == $date) {
71 $date_string = xl("Today") . ", " . oeFormatShortDate($date);
72 } else {
73 $date_string = oeFormatShortDate($date);
76 $card = '';
77 $card .= '<div class="card panel-default">';
78 $card .= ' <div class="card-heading">';
79 $card .= ' <h3 class="card-title">' . text($date_string) . ' <strong>(' . text($note['user']) . ')</strong></h3>';
80 $card .= ' </div>';
81 $card .= ' <div class="card-body">';
82 $card .= nl2br(text($note['body']));
83 $card .= ' </div>';
84 $card .= '</div>';
86 print $card;
88 $notes_count++;
93 </table>
94 </div>
96 </body>
97 </html>