sql-injection fix in demographics
[openemr.git] / library / ESign / ESign.php
blobab693007fa227f340dd6ea170816c8c1d31c467d
1 <?php
2 namespace ESign;
4 /**
5 * ESign object consists of the all the essential parts.
6 *
7 * Copyright (C) 2013 OEMR 501c3 www.oemr.org
9 * LICENSE: This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
20 * @package OpenEMR
21 * @author Ken Chapple <ken@mi-squared.com>
22 * @author Medical Information Integration, LLC
23 * @author Brady Miller <brady@sparmy.com>
24 * @link http://www.open-emr.org
25 **/
27 include_once $GLOBALS['srcdir'].'/sql.inc';
29 class ESign
31 private $_configuration = null;
32 private $_signable = null;
33 private $_button = null;
34 private $_log = null;
36 function __construct( ConfigurationIF $configuration, SignableIF $signable, ButtonIF $button, LogIF $log )
38 $this->_configuration = $configuration;
39 $this->_signable = $signable;
40 $this->_button = $button;
41 $this->_log = $log;
44 /**
45 * Check if the signable object is locked from futher editing
47 * @return boolean
49 public function isLocked()
51 return $this->_signable->isLocked();
54 public function isButtonViewable()
56 return $this->_button->isViewable();
59 /**
60 * Check if the log is viewable
61 * @param string $mode Currently supports "default" and "report"
62 * @return boolean
64 public function isLogViewable($mode="default")
66 $viewable = false;
67 if ( count( $this->_signable->getSignatures() ) > 0 ) {
68 // If we have signatures, always show the log.
69 $viewable = true;
70 } else {
71 // If in report mode then hide the log if $_GLOBALS['esign_report_hide_empty_sig'] is true and there are no signatures
72 if ( ($mode=="report") && ($GLOBALS['esign_report_hide_empty_sig']) ) {
73 $viewable = false;
75 else {
76 // defer if viewable to the log object
77 $viewable = $this->_log->isViewable();
81 return $viewable;
84 public function renderLog()
86 $this->_log->render( $this->_signable );
89 public function buttonHtml()
91 return $this->_button->getHtml();
94 public function getSignatures()
96 return $this->_signable->getSignatures();