installation bug fix
[openemr.git] / library / ESign / ESign.php
blobd5957609c73a897bacdf3a95020c0dce199df3ef
1 <?php
2 namespace ESign;
4 /**
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>;.
20 * @package OpenEMR
21 * @author Ken Chapple <ken@mi-squared.com>
22 * @author Medical Information Integration, LLC
23 * @author Brady Miller <brady.g.miller@gmail.com>
24 * @link http://www.open-emr.org
25 **/
28 class ESign
30 private $_configuration = null;
31 private $_signable = null;
32 private $_button = null;
33 private $_log = null;
35 function __construct( ConfigurationIF $configuration, SignableIF $signable, ButtonIF $button, LogIF $log )
37 $this->_configuration = $configuration;
38 $this->_signable = $signable;
39 $this->_button = $button;
40 $this->_log = $log;
43 /**
44 * Check if the signable object is locked from futher editing
46 * @return boolean
48 public function isLocked()
50 return $this->_signable->isLocked();
53 public function isButtonViewable()
55 return $this->_button->isViewable();
58 /**
59 * Check if the log is viewable
60 * @param string $mode Currently supports "default" and "report"
61 * @return boolean
63 public function isLogViewable($mode="default")
65 $viewable = false;
66 if ( count( $this->_signable->getSignatures() ) > 0 ) {
67 // If we have signatures, always show the log.
68 $viewable = true;
69 } else {
70 // If in report mode then hide the log if $_GLOBALS['esign_report_hide_empty_sig'] is true and there are no signatures
71 if ( ($mode=="report") && ($GLOBALS['esign_report_hide_empty_sig']) ) {
72 $viewable = false;
74 else {
75 // defer if viewable to the log object
76 $viewable = $this->_log->isViewable();
80 return $viewable;
83 public function renderLog()
85 $this->_log->render( $this->_signable );
88 public function buttonHtml()
90 return $this->_button->getHtml();
93 public function getSignatures()
95 return $this->_signable->getSignatures();