5 * ESign object consists of the all the essential parts.
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>;.
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
27 include_once $GLOBALS['srcdir'].'/sql.inc';
31 private $_configuration = null;
32 private $_signable = null;
33 private $_button = null;
36 function __construct( ConfigurationIF
$configuration, SignableIF
$signable, ButtonIF
$button, LogIF
$log )
38 $this->_configuration
= $configuration;
39 $this->_signable
= $signable;
40 $this->_button
= $button;
45 * Check if the signable object is locked from futher editing
49 public function isLocked()
51 return $this->_signable
->isLocked();
54 public function isButtonViewable()
56 return $this->_button
->isViewable();
60 * Check if the log is viewable
61 * @param string $mode Currently supports "default" and "report"
64 public function isLogViewable($mode="default")
67 if ( count( $this->_signable
->getSignatures() ) > 0 ) {
68 // If we have signatures, always show the log.
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']) ) {
76 // defer if viewable to the log object
77 $viewable = $this->_log
->isViewable();
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();