migrated ubiquitous libraries to composer autoloader (#421)
[openemr.git] / library / ESign / Encounter / Signable.php
blob737267d9b10ac20bbd757d3fe9041c6be0400640
1 <?php
3 namespace ESign;
5 /**
6 * Implementation of the SignableIF interface for the Encounter
7 * module.
9 * Copyright (C) 2013 OEMR 501c3 www.oemr.org
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @package OpenEMR
23 * @author Ken Chapple <ken@mi-squared.com>
24 * @author Medical Information Integration, LLC
25 * @link http://www.open-emr.org
26 **/
28 require_once $GLOBALS['srcdir'].'/ESign/DbRow/Signable.php';
29 require_once $GLOBALS['srcdir'].'/ESign/SignableIF.php';
30 require_once $GLOBALS['srcdir'].'/ESign/Form/Factory.php';
32 class Encounter_Signable extends DbRow_Signable implements SignableIF
34 private $_encounterId = null;
36 public function __construct( $encounterId )
38 $this->_encounterId = $encounterId;
39 parent::__construct( $encounterId, 'form_encounter' );
42 /**
43 * Implementatinon of getData() for encounters.
45 * We get all forms under the encounter, and then get all the data
46 * from the individual form tables.
48 * @see \ESign\SignableIF::getData()
50 public function getData()
52 $encStatement = "SELECT F.id, F.date, F.encounter, F.form_name, F.form_id, F.pid, F.user, F.formdir FROM forms F ";
53 $encStatement .= "WHERE F.encounter = ? ";
54 $data = array();
55 $res = sqlStatement( $encStatement, array( $this->_encounterId ) );
56 while ( $encRow = sqlFetchArray( $res ) ) {
57 $formFactory = new Form_Factory( $encRow['id'], $encRow['formdir'], $this->_encounterId );
58 $signable = $formFactory->createSignable();
59 $data[]= $signable->getData();
61 return $data;
64 public function isLocked()
66 $locked = false;
67 if ( $GLOBALS['lock_esign_all'] ) {
68 $locked = parent::isLocked();
71 return $locked;